Тёмный

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

shashCode
Подписаться 14 тыс.
Просмотров 1,5 тыс.
50% 1

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/problems/minimum...
Java Plus DSA Placement Course Playlist:
• Java and DSA Course Pl...
Java Plus DSA Sheet:
docs.google.com/spreadsheets/...
Notes:
github.com/Tiwarishashwat/Jav...
Telegram Link:
shashwattiwari.page.link/tele...
Ultimate Recursion Series Playlist:
• Recursion and Backtrac...
Instagram Handle: (@shashwat_tiwari_st)
shashwattiwari.page.link/shas...
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​

Опубликовано:

 

11 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 12   
@shivendrasingh8520
@shivendrasingh8520 22 дня назад
bhaiya you are one the best teacher bhaiya underrated matlab koi aise nahi alag alag approaches batata hai bhaiya
@abdullahintisar7365
@abdullahintisar7365 22 дня назад
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
@RohitKumar-dz8dh
@RohitKumar-dz8dh 22 дня назад
Thanks 😊
@aggarwalsachin4854
@aggarwalsachin4854 23 дня назад
good explaination
@PrakashRai-ff3pr
@PrakashRai-ff3pr 22 дня назад
sir which u explained before coding i get it but plz after code try to explain code too sometimes samj nhi aata ...
@SMS_news
@SMS_news 22 дня назад
Vi a graph ar dp ki playlist chalu kor diji a joldi😊😊
@vishalsuryan1797
@vishalsuryan1797 23 дня назад
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 22 дня назад
Excellent work 👏
@vedictechyog
@vedictechyog 23 дня назад
please provide the code also
@SulemanbhashaDodmni
@SulemanbhashaDodmni 22 дня назад
sulemanbhasha dodmani
@SulemanbhashaDodmni
@SulemanbhashaDodmni 22 дня назад
linkedin pe message kiya hu dekhe nhi ap
Далее
Incredible magic 🤯✨
00:53
Просмотров 15 млн
Куда Анджилиша снова летит???
00:16
How Dijkstra's Algorithm Works
8:31
Просмотров 1,3 млн
How I would learn Leetcode if I could start over
18:03
Просмотров 300 тыс.