"We can use dictionary to store cache items so that our read / write operations will be O(1).
Each time we read or update an existing record, we have to ensure the item is moved to the back of the cache. This will allow us to evict the first item in the cache whenever the cache is full and we need to add new records also making our eviction O(1)
Instead of normal dictionary, we will use ordered dictionary to store cache items. This will allow us to efficiently move items to back of the cache a"
Alfred O. - "We can use dictionary to store cache items so that our read / write operations will be O(1).
Each time we read or update an existing record, we have to ensure the item is moved to the back of the cache. This will allow us to evict the first item in the cache whenever the cache is full and we need to add new records also making our eviction O(1)
Instead of normal dictionary, we will use ordered dictionary to store cache items. This will allow us to efficiently move items to back of the cache a"See full answer
"As a PM i received a feedback from my program manager on my style of verbal communication. It is about me speaking faster when i wanted to get away with a topic that i wasn't confident (may be not backed up with data, or still in process of getting detailed insight of a problem etc.). Whereas when I'm confident I tend to speak slowly or more assertively that made people to follow easily.
I welcomed that feedback so from then on when I'm not confident in a topic I became more assertive to let pe"
Rajesh V. - "As a PM i received a feedback from my program manager on my style of verbal communication. It is about me speaking faster when i wanted to get away with a topic that i wasn't confident (may be not backed up with data, or still in process of getting detailed insight of a problem etc.). Whereas when I'm confident I tend to speak slowly or more assertively that made people to follow easily.
I welcomed that feedback so from then on when I'm not confident in a topic I became more assertive to let pe"See full answer
"class Solution:
def lengthOfLIS(self, nums: List[int]) -> int:
temp = [nums[0]]
for num in nums:
if temp[-1]< num:
temp.append(num)
else:
index = bisect_left(temp,num)
temp[index] = num
return len(temp)
"
Mahima M. - "class Solution:
def lengthOfLIS(self, nums: List[int]) -> int:
temp = [nums[0]]
for num in nums:
if temp[-1]< num:
temp.append(num)
else:
index = bisect_left(temp,num)
temp[index] = num
return len(temp)
"See full answer
"Use a representative of each, e.g. sort the string and add it to the value of a hashmap> where we put all the words that belong to the same anagram together."
Gaston B. - "Use a representative of each, e.g. sort the string and add it to the value of a hashmap> where we put all the words that belong to the same anagram together."See full answer
"Any cycle would cause the prerequisite to be greater than the course. This passes all the tests:
function canFinish(_numCourses, prerequisites) {
for (const [a, b] of prerequisites) {
if (b > a) return false
}
return true
}
`"
Jeremy D. - "Any cycle would cause the prerequisite to be greater than the course. This passes all the tests:
function canFinish(_numCourses, prerequisites) {
for (const [a, b] of prerequisites) {
if (b > a) return false
}
return true
}
`"See full answer
"Sharing the approach for functional requirements we tool to solve this question.
Functional Requirements
This is only for the Registered users
What is a "For You" page ?
Home page where you get suggestions based on
people you follow.
Interactions
like/share/comments (done by user)
Interests (shared by the user during registration or onboarding)
sports choices/ region choices/
Video sharing platform.
So how many videos should we s"
Anonymous Hare - "Sharing the approach for functional requirements we tool to solve this question.
Functional Requirements
This is only for the Registered users
What is a "For You" page ?
Home page where you get suggestions based on
people you follow.
Interactions
like/share/comments (done by user)
Interests (shared by the user during registration or onboarding)
sports choices/ region choices/
Video sharing platform.
So how many videos should we s"See full answer
"Initialize left pointer: Set a left pointer left to 0.
Iterate through the array: Iterate through the array from left to right.
If the current element is not 0, swap it with the element at the left pointer and increment left.
Time complexity: O(n). The loop iterates through the entire array once, making it linear time.
Space complexity: O(1). The algorithm operates in-place, modifying the input array directly without using additional data structures.
"
Avon T. - "Initialize left pointer: Set a left pointer left to 0.
Iterate through the array: Iterate through the array from left to right.
If the current element is not 0, swap it with the element at the left pointer and increment left.
Time complexity: O(n). The loop iterates through the entire array once, making it linear time.
Space complexity: O(1). The algorithm operates in-place, modifying the input array directly without using additional data structures.
"See full answer
"\# Definition for a binary tree node.
class TreeNode:
def init(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def maxPathSum(self, root: TreeNode) -> int:
self.max_sum = float('-inf')"
Jerry O. - "\# Definition for a binary tree node.
class TreeNode:
def init(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def maxPathSum(self, root: TreeNode) -> int:
self.max_sum = float('-inf')"See full answer
"
from typing import List
def getnumberof_islands(binaryMatrix: List[List[int]]) -> int:
if not binaryMatrix: return 0
rows = len(binaryMatrix)
cols = len(binaryMatrix[0])
islands = 0
for r in range(rows):
for c in range(cols):
if binaryMatrixr == 1:
islands += 1
dfs(binaryMatrix, r, c)
return islands
def dfs(grid, r, c):
if (
r = len(grid)
"
Rick E. - "
from typing import List
def getnumberof_islands(binaryMatrix: List[List[int]]) -> int:
if not binaryMatrix: return 0
rows = len(binaryMatrix)
cols = len(binaryMatrix[0])
islands = 0
for r in range(rows):
for c in range(cols):
if binaryMatrixr == 1:
islands += 1
dfs(binaryMatrix, r, c)
return islands
def dfs(grid, r, c):
if (
r = len(grid)
"See full answer
"def find_primes(n):
lst=[]
for i in range(2,n+1):
is_prime=1
for j in range(2,int(i**0.5)+1):
if i%j==0:
is_prime=0
break
if is_prime:
lst.append(i)
return lst
"
Anonymous Raccoon - "def find_primes(n):
lst=[]
for i in range(2,n+1):
is_prime=1
for j in range(2,int(i**0.5)+1):
if i%j==0:
is_prime=0
break
if is_prime:
lst.append(i)
return lst
"See full answer
"from typing import List
def three_sum(nums: List[int]) -> List[List[int]]:
nums.sort()
triplets = set()
for i in range(len(nums) - 2):
firstNum = nums[i]
l = i + 1
r = len(nums) - 1
while l 0:
r -= 1
elif potentialSum < 0:
l += 1
"
Anonymous Roadrunner - "from typing import List
def three_sum(nums: List[int]) -> List[List[int]]:
nums.sort()
triplets = set()
for i in range(len(nums) - 2):
firstNum = nums[i]
l = i + 1
r = len(nums) - 1
while l 0:
r -= 1
elif potentialSum < 0:
l += 1
"See full answer
"My leadership style is flexible and adaptive, it varies depending on the team members and the needs of the company. My leadership goal is to empower the team and inspire and grow leaders. In order to achieve that, I combine transformational, democratic and coaching leadership styles.
Usually when we are facing a new type of challenge, or at the early stage of a project, I like to adapt the transformational leadership which allows me to listen to all the suggestions from the team members and sta"
onering2ruleall - "My leadership style is flexible and adaptive, it varies depending on the team members and the needs of the company. My leadership goal is to empower the team and inspire and grow leaders. In order to achieve that, I combine transformational, democratic and coaching leadership styles.
Usually when we are facing a new type of challenge, or at the early stage of a project, I like to adapt the transformational leadership which allows me to listen to all the suggestions from the team members and sta"See full answer