Find Building Where Alice and Bob Can Meet | Segment Tree | Binary Search | Leetcode 2940

Find Building Where Alice and Bob Can Meet | Segment Tree | Binary Search | Leetcode 2940

Techdose

13 дней назад

5,272 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@selva_274
@selva_274 - 22.12.2024 07:53

Thanks bro

Ответить
@arukanwar
@arukanwar - 22.12.2024 09:31

Nice Explanation 👍

Ответить
@praveenrajrs
@praveenrajrs - 22.12.2024 11:28

does the binary search is applicable for unsorted array ?

Ответить
@BananaButcher
@BananaButcher - 22.12.2024 12:17

amazing explanation

Ответить
@AbdurRahim-ry7tj
@AbdurRahim-ry7tj - 22.12.2024 13:35

very neat and clean explanation

Ответить
@akshatgupta2607
@akshatgupta2607 - 22.12.2024 16:49

What an explaination Sir , hatsoff

Ответить
@onlywrestling7810
@onlywrestling7810 - 22.12.2024 17:04

Python code is giving TLE

Ответить
@lakithakare7387
@lakithakare7387 - 22.12.2024 19:26

Thank you very much.

Ответить
@sailendrachettri8521
@sailendrachettri8521 - 22.12.2024 19:34

Thank you sir :)

Ответить
@modiashish1775
@modiashish1775 - 22.12.2024 20:46

what is wrong in my code

vector<int> leftmostBuildingQueries(vector<int>& heights, vector<vector<int>>& queries)
{
int n = queries.size() ;
vector<int> ans( n , -1 ) ;

for( int i = 0 ; i < n ; i++ )
{
int a = queries[i][0] ;
int b = queries[i][1] ;

for( int j = max(a,b) ; j < heights.size() ; j++ )
{
if( heights[a] <= heights[j] && heights[b] <= heights[j] )
{
ans[i] = j ;
break;
}
}

}

return ans ;
}

Ответить
@SurajYadav-py1do
@SurajYadav-py1do - 24.12.2024 12:37

Amazing explanation sir ❤

Ответить