2501. Longest Square Streak in an Array | Leetcode Daily (POTD) 28 Oct 2024 | Java

  Рет қаралды 733

AlgorithmHQ

AlgorithmHQ

Күн бұрын

Пікірлер: 14
@vaibhavgade8573
@vaibhavgade8573 18 күн бұрын
Space for hash map can be saved using binary search for every iterative square number. For a streak starting with 2, search for 2, 4, 16.
@Axel.Blazer
@Axel.Blazer 18 күн бұрын
yes class Solution: def longestSquareStreak(self, nums: List[int]) -> int: nums = set(nums) streak = -1 for num in sorted(nums): cur = 1 nxt = num * num while nxt in nums: cur += 1 nxt = nxt * nxt if cur >= 2: streak = max(streak, cur) return streak if streak!=1 else -1
@algorithmsbyaditi
@algorithmsbyaditi 18 күн бұрын
Great work
@harishbehera7812
@harishbehera7812 18 күн бұрын
thanx for the video. Radhe Radhe
@algorithmsbyaditi
@algorithmsbyaditi 18 күн бұрын
Glad it was helpful !
@Sumanth2803
@Sumanth2803 18 күн бұрын
nice explanation. Radhe Radhe
@algorithmsbyaditi
@algorithmsbyaditi 18 күн бұрын
Thank you
@KedarBhawthankar
@KedarBhawthankar 18 күн бұрын
nice explaination
@algorithmsbyaditi
@algorithmsbyaditi 18 күн бұрын
Thank you
@rahulsingh-sc1hg
@rahulsingh-sc1hg 18 күн бұрын
Hello Ma'am I am beginner in DSA, Would you create a playlist for beginners? Thank you.
@algorithmsbyaditi
@algorithmsbyaditi 18 күн бұрын
Will try soon, Thanks.
@kthamim7552
@kthamim7552 18 күн бұрын
post a video in english also mam
@chad._life
@chad._life 18 күн бұрын
nice efforts but you could do much better if you invest some more energy and time
@algorithmsbyaditi
@algorithmsbyaditi 18 күн бұрын
I will keep improving my solutions. Thank you
Longest Square Streak in an Array | Leetcode 2501
18:11
Techdose
Рет қаралды 2,2 М.
The IMPOSSIBLE Puzzle..
00:55
Stokes Twins
Рет қаралды 132 МЛН
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 190 МЛН
2501. Longest Square Streak in an Array (Leetcode Medium)
5:38
Programming Live with Larry
Рет қаралды 571
8 patterns to solve 80% Leetcode problems
7:30
Sahil & Sarra
Рет қаралды 429 М.
IIT-JEE Toppers: Where Are They Now?
15:52
Mohak Mangal
Рет қаралды 2,5 МЛН