Amazon Interview Question for SDE-3s


Country: United States




Comment hidden because of low score. Click to expand.
0
of 0 vote

/* 
 this function defines the weight between two vertices
 we are looking at a directed graph, 
  where a->b and b->a will have different weights
*/
def min_click_path( ch_src, ch_dst  ){
   abs_delta = #|ch_src - ch_dst | // this is done by using +/- channel button 
   dst_digits = size( ch_dst , 10 ) // this is the abs number press 
   #(m,M) = minmax( abs_delta, dst_digits )
   m // minimal path from src to dst 
}
/* 
now just assume en.wikipedia.org/wiki/Dijkstra%27s_algorithm
from src to ch_dst 
respond with the weight for ch_dst 
*/

- NoOne May 18, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

It is way simpler than that.

- vomitus maximus June 26, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Need some more clarification on qn. Like
1. Is the start position of iteration is always start of the channel?
2. Is there any requirement like after reaching the max channel no. it will come to the start of channel no?

We can apply simple algm for resolving this:
1. find the min and max of the channel no's present in the array.
2. Get the start position,
3. if it is always start of the channel means, the answer will be max value of channel.

- aneeshas.kollam October 11, 2021 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More