"
This is mostly correct and fairly fast.
My code has a bug somewhere where it fails on cases like the last case, where there are negative number on both ends of the array and the sums .
from collections import deque
debug = True # False
def prdbg(*x):
global debug
debug = True # False
if debug:
print(x)
else:
return
def max_sum(arr, start, end):
if type(arr) == type('''
"
Nathan B. - "
This is mostly correct and fairly fast.
My code has a bug somewhere where it fails on cases like the last case, where there are negative number on both ends of the array and the sums .
from collections import deque
debug = True # False
def prdbg(*x):
global debug
debug = True # False
if debug:
print(x)
else:
return
def max_sum(arr, start, end):
if type(arr) == type('''
"See full answer
"This could be done using two-pointer approach assuming array is sorted: left and right pointers. We need track two sums (left and right) as we move pointers. For moving pointers we will move left to right by 1 (increment) when right sum is greater. We will move right pointer to left by 1 (decrement) when left sum is greater. at some point we will either get the sum same and that's when we exit from the loop. 0-left will be one array and right-(n-1) will be another array.
We are not going to mo"
Bhaskar B. - "This could be done using two-pointer approach assuming array is sorted: left and right pointers. We need track two sums (left and right) as we move pointers. For moving pointers we will move left to right by 1 (increment) when right sum is greater. We will move right pointer to left by 1 (decrement) when left sum is greater. at some point we will either get the sum same and that's when we exit from the loop. 0-left will be one array and right-(n-1) will be another array.
We are not going to mo"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
"Questions to ask :
Are there negative values in the input array? Interview : YES
Will the product of two number fit into 32-bit Integer. If not, will it fit 64-bit Integer. If not, then is it safe to use Big Integer? Interview : let's worry only about 32 bit Integer
What should we return if the input array is null or size (size of input array) is less than 2? Return 0
From above Information:
General approach is as follows :
a) Track smallest 2 elements in the array -> p"
Rajendra D. - "Questions to ask :
Are there negative values in the input array? Interview : YES
Will the product of two number fit into 32-bit Integer. If not, will it fit 64-bit Integer. If not, then is it safe to use Big Integer? Interview : let's worry only about 32 bit Integer
What should we return if the input array is null or size (size of input array) is less than 2? Return 0
From above Information:
General approach is as follows :
a) Track smallest 2 elements in the array -> p"See full answer
"Clarifying question:
Am I the first one to notice the fire, or there are people already on it?
Extent and source of fire - I am assuming it's localized and I am inside the data center, safe so far.
Response:
It is an emergency. I will do and coordinate the people to do the following in parallel, if I am the first one to know.
Get immediate attention of folks in the data center. Get someone and many people to call 911 and security. Coordinate to have people in need evacuated.
Turn off th"
Bg - "Clarifying question:
Am I the first one to notice the fire, or there are people already on it?
Extent and source of fire - I am assuming it's localized and I am inside the data center, safe so far.
Response:
It is an emergency. I will do and coordinate the people to do the following in parallel, if I am the first one to know.
Get immediate attention of folks in the data center. Get someone and many people to call 911 and security. Coordinate to have people in need evacuated.
Turn off th"See full answer
"Below are few key things enterprises look for in a data center :
Location
Proximity to target user base
Potential risk exposure due to natural calamities (hurricane, storms, tornedos etc)
Real estate cost (Service cost will also be proportional to how expensive it is to acquire and run data center)
Security
Physical security
Logical security (Segregation)
Industry standard compliance
PCI DSS
ISO etc
Ability to support HA and DR requir"
Hmm T. - "Below are few key things enterprises look for in a data center :
Location
Proximity to target user base
Potential risk exposure due to natural calamities (hurricane, storms, tornedos etc)
Real estate cost (Service cost will also be proportional to how expensive it is to acquire and run data center)
Security
Physical security
Logical security (Segregation)
Industry standard compliance
PCI DSS
ISO etc
Ability to support HA and DR requir"See full answer
"If it's a product end to end, then there's a lot to say. If it's just a feature on top of a product then I will focus on the complexity and how I break complex tasks into small milestones to partner with XFN teams to nail it. Focus on situation, task, actions and results"
S G. - "If it's a product end to end, then there's a lot to say. If it's just a feature on top of a product then I will focus on the complexity and how I break complex tasks into small milestones to partner with XFN teams to nail it. Focus on situation, task, actions and results"See full answer
"generally at the beginning of ever project the PgM has to come up with 5Ws & a H that translates in to a project charter. this forms the baseline expectations for a project to get kick-started."
Chakravarthy B. - "generally at the beginning of ever project the PgM has to come up with 5Ws & a H that translates in to a project charter. this forms the baseline expectations for a project to get kick-started."See full answer
"Let's apply Porter's Five Forces model to Amazon's business. All of these are my personal opinions.
Industry Rivalry - There's a continuous rivalry in the ecommerce space with each rival trying to focus on specific aspect's of Amazon's business. Walmart (price, convenience), Google Shopping (relevancy, search), Shopify (brand trust, direct buying), eBay (antiques, used, shipping), Facebook Marketplace (buy from 3P sellers).
Threat of new entrants - Amazon continuously faces threa"
Preyas J. - "Let's apply Porter's Five Forces model to Amazon's business. All of these are my personal opinions.
Industry Rivalry - There's a continuous rivalry in the ecommerce space with each rival trying to focus on specific aspect's of Amazon's business. Walmart (price, convenience), Google Shopping (relevancy, search), Shopify (brand trust, direct buying), eBay (antiques, used, shipping), Facebook Marketplace (buy from 3P sellers).
Threat of new entrants - Amazon continuously faces threa"See full answer
"Honestly, In addition to having the right expertise and skills required for this job, I am really looking forward to being part of this organisation’s journey. I am really confident that I will really exceed your expectations in achieving both mine and the company’s goals.
I have worked with different teams in different capacities, managed a team of engineers successfully from very early part of my career and that has made me a very easy person to work with. I get things done easily.
I am passio"
Piyush D. - "Honestly, In addition to having the right expertise and skills required for this job, I am really looking forward to being part of this organisation’s journey. I am really confident that I will really exceed your expectations in achieving both mine and the company’s goals.
I have worked with different teams in different capacities, managed a team of engineers successfully from very early part of my career and that has made me a very easy person to work with. I get things done easily.
I am passio"See full answer
"I am working as Scrum Master and I am handling daily status meetings, weekly stakeholders meetings and Initiating Sprint planning."
Srinivas A. - "I am working as Scrum Master and I am handling daily status meetings, weekly stakeholders meetings and Initiating Sprint planning."See full answer
"One way to develop project metrics is around what problem the project is trying to solve within a particular timeframe, at a cost of x dollars and with y quality
Scope:
Did the project deliver as per the problem statement - over and beyond
Resources metrics:
Planned resources were utilized to contribute to the success
Budget:
Did the cost of the project implementation be under the budget or over?
Schedule:
In-flight milestones were completed on time or not as per the plan
Was the proje"
Y C. - "One way to develop project metrics is around what problem the project is trying to solve within a particular timeframe, at a cost of x dollars and with y quality
Scope:
Did the project deliver as per the problem statement - over and beyond
Resources metrics:
Planned resources were utilized to contribute to the success
Budget:
Did the cost of the project implementation be under the budget or over?
Schedule:
In-flight milestones were completed on time or not as per the plan
Was the proje"See full answer
"I will look at the % of overspend. If we are within 10%, I would not worry about it too much as most budgets factor in 10% contingency.
If Budget has exceeded 10% Threshold, I will use the following approach:
Deep dive on current status:
Understand % work completed/accepted
Analyse Schedule/Time progress
Understand Project Priority: P1/P2/P3
Resourcing: Internal/External
Complexity: Technical design (Number of Applications involved/ Number of Interfaces to be build e"
Saket S. - "I will look at the % of overspend. If we are within 10%, I would not worry about it too much as most budgets factor in 10% contingency.
If Budget has exceeded 10% Threshold, I will use the following approach:
Deep dive on current status:
Understand % work completed/accepted
Analyse Schedule/Time progress
Understand Project Priority: P1/P2/P3
Resourcing: Internal/External
Complexity: Technical design (Number of Applications involved/ Number of Interfaces to be build e"See full answer