"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
"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
"\# 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
Software Engineer
Data Structures & Algorithms
+4 more
🧠Want an expert answer to a question? Saving questions lets us know what content to make next.
"That's really interesting how in section "Behavioral Interviews for Engineers" there is no single interview for, actually, Engineer.
It's EM, SA, CEO, PM etc. So all problems are not relevant for people who are not managing products and not applying for manager's role.
Will you consider adding at least couple of them?
"
Nikolas C. - "That's really interesting how in section "Behavioral Interviews for Engineers" there is no single interview for, actually, Engineer.
It's EM, SA, CEO, PM etc. So all problems are not relevant for people who are not managing products and not applying for manager's role.
Will you consider adding at least couple of them?
"See full answer
"Getting things done : I am extremely proud of walking the extra mile to get things done which I am extremely proud of in my career
Ladder transfer : Being on the tactical front, to dream about creating a product from its inception to the delivery and being able to achieve it
Gaining trust : Leading without authority is critical and gaining trust in the process of the peers and stakeholders is one thing I am extremely proud of."
Googlepm 1. - "Getting things done : I am extremely proud of walking the extra mile to get things done which I am extremely proud of in my career
Ladder transfer : Being on the tactical front, to dream about creating a product from its inception to the delivery and being able to achieve it
Gaining trust : Leading without authority is critical and gaining trust in the process of the peers and stakeholders is one thing I am extremely proud of."See full answer
"This is a Strategy Question, which asks you to justify high-level business decisions and strategy. With many acquisition strategy questions, we can first look at core competencies and synergies before offering more complex reasoning.
Let's go over one possible solution:
> There's many different reasons why Twilio acquired SendGrid, my top three reasons would be:Owning more of the communications network
> More data
> Upselling to SendGrid customers
>
Owning more of the communications netw"
Exponent - "This is a Strategy Question, which asks you to justify high-level business decisions and strategy. With many acquisition strategy questions, we can first look at core competencies and synergies before offering more complex reasoning.
Let's go over one possible solution:
> There's many different reasons why Twilio acquired SendGrid, my top three reasons would be:Owning more of the communications network
> More data
> Upselling to SendGrid customers
>
Owning more of the communications netw"See full answer