I swear that you provide one of the highest, if not the highest, quality explanations on KZbin! Thank you so much for this. I understood each problem you uploaded on this channel completely!
@LeetCodeUniversity2 жыл бұрын
Thank you so much! I am so glad that I’m providing value to you. I will always upload the highest explanations on KZbin!
@balu69232 жыл бұрын
Thank you for taking the time to do this. I saw your post on reddit and came over to check out the channel! Great work and goodluck.
@LeetCodeUniversity2 жыл бұрын
Thank you so much for the support and I am so glad that I am providing value to you!
@HarshitShrivastava142 жыл бұрын
You could use a regular for loop (int i = 0; i < nums.length;) instead of the foreach loop and increment the loop control variable, `i` after you have incremented the length and similarly in an else case - this way you can directly skip the numbers in the outer loop where you do not see a sequence starting and getting a better runtime.
@LeetCodeUniversity2 жыл бұрын
Yes that is correct, thank you!
@anishaa3298 Жыл бұрын
thank you so much!!!!!!!!!!!!!!!! super easy to understand :)
@LeetCodeUniversity Жыл бұрын
Thank you!!
@floatingfortress7212 жыл бұрын
Approach #3: For an array with duplicates e.g. nums = [0, 0, 0, 1, 4, 3, 2] we'd generate the sequence three times!
@LeetCodeUniversity2 жыл бұрын
That is correct. Since there is nothing smaller than 0 it will be the start of a sequence and thus we need to check the sequence generated by it. Now we have 3 0’s, so we will generate 3 exact sequences of the same length, but that length is the answer. In this case length=4
@mirriammaina686010 ай бұрын
Isn't time complextity worst case scenario? Worst case for this code is 2 loops for each num without a sequence since we always start at num + 0. I don't understand how this is O(n) time complexity
@wajihakhan8618 Жыл бұрын
why you used while loop in line 11 can you explain this?