Great explanation ! Can someone please explain the time complexity here?Thankyou.
@CodeWithSunchitDudeja3 жыл бұрын
I have mentioned it in one of the comments below
@dianayao1677 Жыл бұрын
Love this explanation ! can you please also explain the time complexity and space complexity? Appreciate it!
@Sailgodgreenearth2 жыл бұрын
what a beautiful explanation. Loved it
@amazinglife54003 жыл бұрын
Can't it be done by DFS approach also effectively? As I tried it like this in every traversal taking 2 different variations for individual digit of a lock and then passing on to next traversal making 8 new recursive possibilities for a single lock. Would it blew off time complexity?
@LegitGamer23453 жыл бұрын
its overkill to use dfs here
@pr4nshul3 жыл бұрын
hey i had a doubt in line 20 , why are we checking whether the front of the queue is visited , as we are only pushing those states which are not visited in line 24 , video time 10:17
@Versole2 жыл бұрын
Nice explanation
@dhananjayseetha42513 жыл бұрын
You have messed up the example(which is also the first test case in challenge) where our target is 0202, what you are achieving is 2202 but we have to achieve 0202.See the video around 8:30
@CodeWithSunchitDudeja3 жыл бұрын
Thanks man for telling, I was simultaneously doing something my bad
@dhananjayseetha42513 жыл бұрын
@@CodeWithSunchitDudeja Love you brother ,No problem you know amazing thing is viewers enhance the quality of instructor by poking out these things so that mistakes are not repeated.I hope you will pay attention next time 😁.Except this issue everything is perfect , keep up the good work bro 💥💥.
@mayanktiwari3103 Жыл бұрын
finally undertood this problem
@kaushikkampli69113 жыл бұрын
Is there a DFS or recursive counterpart to this solution? Great video though!
@LegitGamer23453 жыл бұрын
bro in questions like these its overkill to use dfs the code gets really complicated
@sanchitmehra10793 жыл бұрын
awesome explanation :)
@CodeWithSunchitDudeja3 жыл бұрын
Glad you liked it!
@vinny41617 ай бұрын
great bro thanks!!
@algorithmo1343 жыл бұрын
Why does your code doesnt have modulus? I have seen many code that contain % operation in leetcode solution.
@CodeWithSunchitDudeja3 жыл бұрын
Why do you need it?
@algorithmo1343 жыл бұрын
@@CodeWithSunchitDudeja reduces time complexity
@heyrmi3 жыл бұрын
Thank you.
@CodeWithSunchitDudeja3 жыл бұрын
Thnx
@tathagatnegi59233 жыл бұрын
Thanks
@CodeWithSunchitDudeja3 жыл бұрын
Thnx
@LegitGamer23453 жыл бұрын
clean code gg
@CodeWithSunchitDudeja3 жыл бұрын
Thnx
@rogerop67213 жыл бұрын
what will be the time complexity ?
@CodeWithSunchitDudeja3 жыл бұрын
🧐, my hunch is somewhere around O(10^4)/2, as we are going from 0000 upto 9999. Dividing it by 2 since we always have 2 directions to go in. So Max you need to go up till O(5000).