Тёмный

2582. Pass the Pillow | Maths | leetcode daily challenge | DSA | Hindi 

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

Problem Name:
2582. Pass the Pillow
Problem Statement:
There are n people standing in a line labeled from 1 to n. The first person in the line is holding a pillow initially. Every second, the person holding the pillow passes it to the next person standing in the line. Once the pillow reaches the end of the line, the direction changes, and people continue passing the pillow in the opposite direction.
For example, once the pillow reaches the nth person they pass it to the n - 1th person, then to the n - 2th person and so on.
Given the two positive integers n and time, return the index of the person holding the pillow after time seconds.
Problem Link:
leetcode.com/problems/pass-th...
Graph Playlist:
• Graph Data Structure S...
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​

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

 

30 июл 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 11   
@shashwat_tiwari_st
@shashwat_tiwari_st 25 дней назад
like target is 80. Also, ye medium level problem hai okay, this is not easy one, agar optimised solution code na kr pae ho toh tension mat lena!!
@user-cr8pd4gn9t
@user-cr8pd4gn9t 21 день назад
Clear Explanation...thanks bro...!!
@saisree04
@saisree04 24 дня назад
Amazing explanation thank youuuu
@RohitKumar-dz8dh
@RohitKumar-dz8dh 25 дней назад
Thanks 😊
@GirjeshSharma-zv3xo
@GirjeshSharma-zv3xo 25 дней назад
Love from japan❤
@tanmoysenapati
@tanmoysenapati 25 дней назад
Thank You
@eklavya22k34
@eklavya22k34 25 дней назад
v easy explanation . thanks
@PiyushSharma-we8yd
@PiyushSharma-we8yd 25 дней назад
passing the parcel khelne wala samay jada behtaar tha 🥲🥲
@shashwat_tiwari_st
@shashwat_tiwari_st 25 дней назад
💯
@adarshjain3058
@adarshjain3058 25 дней назад
Question toh khud kar liya... Bas attendance lagane aaya hu😌
@ArunKumar-gx8iv
@ArunKumar-gx8iv 25 дней назад
Brute Force solution with 100% faster public int passThePillow(int n, int time) { int pillowPosition = 1; int currentTime = 0; boolean isBack = false; // time is taken modulo 2n-2 because the pillow completes a round in 2n-2 seconds time = time * (2 * n - 2); while (currentTime < time) { if (!isBack) { pillowPosition++; } else { pillowPosition--; } if (pillowPosition == 1 || pillowPosition == n) { isBack = !isBack; } currentTime++; } return pillowPosition; }
Далее
How I would learn Leetcode if I could start over
18:03
Просмотров 382 тыс.
10 Math Concepts for Programmers
9:32
Просмотров 1,8 млн
How to Solve ANY LeetCode Problem (Step-by-Step)
12:37
Просмотров 149 тыс.
My Brain after 569 Leetcode Problems
7:50
Просмотров 2,5 млн