2037. Minimum Number of Moves to Seat Everyone | leetcode daily challenge | DSA | Hindi

  Рет қаралды 1,814

shashCode

shashCode

Күн бұрын

Problem Name:
2037. Minimum Number of Moves to Seat Everyone
Problem Statement:
There are n seats and n students in a room. You are given an array seats of length n, where seats[i] is the position of the ith seat. You are also given the array students of length n, where students[j] is the position of the jth student.
You may perform the following move any number of times:
Increase or decrease the position of the ith student by 1 (i.e., moving the ith student from position x to x + 1 or x - 1)
Return the minimum number of moves required to move each student to a seat such that no two students are in the same seat.
Note that there may be multiple seats or students in the same position at the beginning.
Problem link:
leetcode.com/p...
Java Plus DSA Placement Course Playlist:
• Java and DSA Course Pl...
Java Plus DSA Sheet:
docs.google.co...
Notes:
github.com/Tiw...
Telegram Link:
shashwattiwari...
Ultimate Recursion Series Playlist:
• Recursion and Backtrac...
Instagram Handle: (@shashwat_tiwari_st)
shashwattiwari...
Samsung Interview Experience:
• I cracked Samsung | SR...
Company Tags:
Facebook | Amazon | Microsoft | Netflix | Google | LinkedIn | Pega Systems | VMware | Adobe | Samsung
Timestamp:
0:00 - Introduction
#ShashwatTiwari #coding​​ #problemsolving​

Пікірлер: 12
@shivendrasingh8520
@shivendrasingh8520 3 ай бұрын
bhaiya you are one the best teacher bhaiya underrated matlab koi aise nahi alag alag approaches batata hai bhaiya
@abdullahintisar7365
@abdullahintisar7365 3 ай бұрын
i did it like this understand the problem from you and tried to do it. int minMovesToSeat(vector& seats, vector& students) { sort(seats.begin(),seats.end()); sort(students.begin(), students.end()); int diff = 0; for(int i = 0; i< seats.size();i++) { diff += (abs(seats[i]-students[i])); } return diff; } time complexity = nlogn
@vishalsuryan1797
@vishalsuryan1797 3 ай бұрын
Bhaiya I was able to think of the brute force solution within 2 mins and coded it exactly as you did
@shashwat_tiwari_st
@shashwat_tiwari_st 3 ай бұрын
Excellent work 👏
@RohitKumar-dz8dh
@RohitKumar-dz8dh 3 ай бұрын
Thanks 😊
@aggarwalsachin4854
@aggarwalsachin4854 3 ай бұрын
good explaination
@SMS_news
@SMS_news 3 ай бұрын
Vi a graph ar dp ki playlist chalu kor diji a joldi😊😊
@PrakashRai-ff3pr
@PrakashRai-ff3pr 3 ай бұрын
sir which u explained before coding i get it but plz after code try to explain code too sometimes samj nhi aata ...
@vedictechyog
@vedictechyog 3 ай бұрын
please provide the code also
@SulemanbhashaDodmni
@SulemanbhashaDodmni 3 ай бұрын
sulemanbhasha dodmani
@SulemanbhashaDodmni
@SulemanbhashaDodmni 3 ай бұрын
linkedin pe message kiya hu dekhe nhi ap
大家都拉出了什么#小丑 #shorts
00:35
好人小丑
Рет қаралды 84 МЛН
Or is Harriet Quinn good? #cosplay#joker #Harriet Quinn
00:20
佐助与鸣人
Рет қаралды 50 МЛН
小丑妹妹插队被妈妈教训!#小丑#路飞#家庭#搞笑
00:12
家庭搞笑日记
Рет қаралды 26 МЛН
At the end of the video, deadpool did this #harleyquinn #deadpool3 #wolverin #shorts
00:15
Anastasyia Prichinina. Actress. Cosplayer.
Рет қаралды 17 МЛН
Leetcode 46. Permutations : Introduction to backtracking
10:06
ComputerBread
Рет қаралды 95 М.
Cursor Is Beating VS Code (...by forking it)
18:00
Theo - t3․gg
Рет қаралды 43 М.
The unfair way I mastered Leetcode
8:02
Sahil & Sarra
Рет қаралды 36 М.
Filling bookcase shelves problem using dynamic programming
26:38
大家都拉出了什么#小丑 #shorts
00:35
好人小丑
Рет қаралды 84 МЛН