This LC was asked in Amazon, Airbnb
Автор: Imagination To Code
Загружено: 2025-03-28
Просмотров: 30
Описание:
I have solved lc-2503 using brute force traversal (asked in Amazon, Airbnb)
Problem Link:
https://leetcode.com/problems/maximum-numb...
Timestamps :
00:00
Hello guys, let's solve today's LeakFood challenge 2503 which has been asked in Amazon as well as Flipkart.
00:09
This is the grid given to us, 3 x 3 with certain values and a variance array is also given to us where each query represents a value which would be our benchmark for choosing how many counts of values are less than this value in the grid.
00:29
and we can move from the leftmost grid up to right, left, up and down directions.
00:44
And whenever we find such a variance, we will increment our count by 1 and return the total count after traversing through the grid.
00:58
using the given conditions.
01:01
So for i equals to 0, we have query value as 5.
01:06
So 1, 2, 3 and 2, 3, these 5 values would be less than 5.
01:11
So that would be our count and we would store the output of 0 as 1, sorry 5.
01:20
Now i equals to 2, value is 6.
01:23
1, 2, 3, 2, 3, 5, 5, 1, these all values would bewould increment the count so count would become 8 and we will store 8 as the second index count.
01:39
Now i2 we only have this one value so our answer would be 1 here.
01:45
This is our BFS or BFS traversal.
01:50
Using brute force simulation time complexity would be variance q into BFS or DFSTime complexity suggests to be cumin to mxl.
02:04
OK so this is the brute force code which I included.
02:09
Actually it will not pass all the test cases.
02:17
17 out of 29 test cases because we get
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: