Skip to content
We areTOP 1%

Social Distance

MediumRating 1300CodeforcesGreedy
Solve on Codeforces(opens in a new tab)
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews
Approach hintTry it first, then reveal

Scan from left to right and occupy a free table whenever no occupied table lies within distance k on either side; taking the earliest valid table never hurts later choices.

More in Greedy

Greedy questions
#ProblemPlatformDifficultyOpen1st1st Visit2nd2nd VisitRevRevise
1Assign CookiesLeetCodeEasy Solve Assign Cookies on LeetCode (opens in a new tab)
2Lemonade ChangeLeetCodeEasy Solve Lemonade Change on LeetCode (opens in a new tab)
3BerSU BallCodeforcesEasy 1200Solve BerSU Ball on Codeforces (opens in a new tab)
4Alternating SubsequenceCodeforcesEasy 1200Solve Alternating Subsequence on Codeforces (opens in a new tab)
5Stable GroupsCodeforcesEasy 1200Solve Stable Groups on Codeforces (opens in a new tab)
6Young ExplorersCodeforcesEasy 1200Solve Young Explorers on Codeforces (opens in a new tab)
7Jump GameLeetCodeMedium Solve Jump Game on LeetCode (opens in a new tab)
8Jump Game IILeetCodeMedium Solve Jump Game II on LeetCode (opens in a new tab)
9Gas StationLeetCodeMedium Solve Gas Station on LeetCode (opens in a new tab)
10Partition LabelsLeetCodeMedium Solve Partition Labels on LeetCode (opens in a new tab)
11Social DistanceCodeforcesMedium 1300Solve Social Distance on Codeforces (opens in a new tab)
12QueueCodeforcesMedium 1300Solve Queue on Codeforces (opens in a new tab)
13ExamsCodeforcesMedium 1400Solve Exams on Codeforces (opens in a new tab)
14Given Length and Sum of Digits...CodeforcesMedium 1400Solve Given Length and Sum of Digits... on Codeforces (opens in a new tab)
15Arranging The SheepCodeforcesMedium 1400Solve Arranging The Sheep on Codeforces (opens in a new tab)
16WoodcuttersCodeforcesMedium 1500Solve Woodcutters on Codeforces (opens in a new tab)
17CandyLeetCodeHard Solve Candy on LeetCode (opens in a new tab)

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account