"
At low level:
I would use two stacks: one for forward history and other for backward history.
i go to tryexponent.com => this url will be stored in backward history stack.
i go to google => again this url will be stored in backward history stack.
i press back => data from backward history will be popped and put in to forward history stack.
I press forward => data from forward history stack will be popped and put in to backward history tab.
Also, whenever i go to any url,"
Anubhav S. - "
At low level:
I would use two stacks: one for forward history and other for backward history.
i go to tryexponent.com => this url will be stored in backward history stack.
i go to google => again this url will be stored in backward history stack.
i press back => data from backward history will be popped and put in to forward history stack.
I press forward => data from forward history stack will be popped and put in to backward history tab.
Also, whenever i go to any url,"See full answer
"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
"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
"It would have been more interesting to focus on the system design rather than the Trie DS, Interviewee could have just mentioned the Trie and passed to things more important.
Interviewee should have focused on the factors on which he wants to scale the API servers, popularity of the query parts ? region may be ? A hash of many factors ?
Caches should have definitely be discussed, Cache eviction policies, Cache invalidation managements...
Interviewee should have mentioned which kind of API pro"
Aymen D. - "It would have been more interesting to focus on the system design rather than the Trie DS, Interviewee could have just mentioned the Trie and passed to things more important.
Interviewee should have focused on the factors on which he wants to scale the API servers, popularity of the query parts ? region may be ? A hash of many factors ?
Caches should have definitely be discussed, Cache eviction policies, Cache invalidation managements...
Interviewee should have mentioned which kind of API pro"See full answer
Software Engineer
System Design
+1 more
🧠 Want an expert answer to a question? Saving questions lets us know what content to make next.
"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
"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
"I
aim to utilize hands-on activities to apply the knowledge I've acquired, safeguard the organization from threat actors, and contribute to its growth."
Bravin V. - "I
aim to utilize hands-on activities to apply the knowledge I've acquired, safeguard the organization from threat actors, and contribute to its growth."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