"we can use two pointer + set like maintain i,j and also insert jth character to set like while set size is equal to our window j-i+1 then maximize our answer and increase jth pointer till last index"
Kishor J. - "we can use two pointer + set like maintain i,j and also insert jth character to set like while set size is equal to our window j-i+1 then maximize our answer and increase jth pointer till last index"See full answer
"This is a great question! If you don't mind, I'd love to list 3 strengths and weaknesses then dive a little deeper on one of each of them.
I think my three greatest strengths are:
Empathy
Openness to feedback
Drive
And three weaknesses I have been working to strengthen are:
Sometimes my desire to achieve can put me at risk of overcommitting
Communicating status to the right stakeholders at the appropriate time
Creating detailed and strategic lists of priorities so I can meet th"
Adam M. - "This is a great question! If you don't mind, I'd love to list 3 strengths and weaknesses then dive a little deeper on one of each of them.
I think my three greatest strengths are:
Empathy
Openness to feedback
Drive
And three weaknesses I have been working to strengthen are:
Sometimes my desire to achieve can put me at risk of overcommitting
Communicating status to the right stakeholders at the appropriate time
Creating detailed and strategic lists of priorities so I can meet th"See full answer
"Arrays.sort(inputarray)
sliding window with a size of 2.
Check for the sum in the sliding window.
subtract the start when window moves"
Sridhar R. - "Arrays.sort(inputarray)
sliding window with a size of 2.
Check for the sum in the sliding window.
subtract the start when window moves"See full answer
"
O(n) time, O(1) space
from typing import List
def maxsubarraysum(nums: List[int]) -> int:
if len(nums) == 0:
return 0
maxsum = currsum = nums[0]
for i in range(1, len(nums)):
currsum = max(currsum + nums[i], nums[i])
maxsum = max(currsum, max_sum)
return max_sum
debug your code below
print(maxsubarraysum([-1, 2, -3, 4]))
`"
Rick E. - "
O(n) time, O(1) space
from typing import List
def maxsubarraysum(nums: List[int]) -> int:
if len(nums) == 0:
return 0
maxsum = currsum = nums[0]
for i in range(1, len(nums)):
currsum = max(currsum + nums[i], nums[i])
maxsum = max(currsum, max_sum)
return max_sum
debug your code below
print(maxsubarraysum([-1, 2, -3, 4]))
`"See full answer
"We can use a pool of memory where each index we can store the parent of current index then we can use same lca approach for array instead of pointers."
Sourav K. - "We can use a pool of memory where each index we can store the parent of current index then we can use same lca approach for array instead of pointers."See full answer
Software Engineer
Data Structures & Algorithms
🧠Want an expert answer to a question? Saving questions lets us know what content to make next.