Amazon Interview Question for SDE-2s


Country: India
Interview Type: In-Person




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

I am trying little bit if anybody want to add and correct it will be my pleasure.

class EventStore {
Client client; // client handle stored when connection established with calender

list <event> myevents;
Addevent(id); // event identify by unique id
RemoveEvents(id);

Callbackfunction(id) {
occuredevent = getevent(id); // we can use hasing to get event from id
client.send( occuredevent);
}

};

class Event {
id;
Eventstore es;
AddAlarm();
RemoveAlarm();
notify() {
es.Callbackfunction(id);
}
};

class Alarm {
Event event;
startAlarm(e) {
event = e;
// start timer
}
TimerEnds() {
event.notify();
}
}


////////////////////////
client side

class Client {
EventStore ev;
EstablishConnection() {
ev = getEventStore()
ev.setclient(this)
}
AddEvent()
{
Event event = new Event;
event.details();
event.Addalarm();
ev.AddEvent(event);
}
void send(event) {
static Window w =NULL;
if( w = NULL) {
w = new Window;
}
w.display(event)
}

};

- Anonymous September 01, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I am thinking of using observer pattern for notifications....
main entities/classes:

ReminderMessage{public string message {get;set;} }
ReminderPopup {/* represents popup message contains OS info*/}
CalendarEntry{public DateTime time; public DateTime reminderTime; public ReminderMessage message;}
Calendar { private CalendarNotificationManager notificationManager; private SortedHashSet <CalendarEntry> entries;
public void AddEntry(CalendarEntry entry){}
public CalendarEntry [] GetEntries(DateTime calendarDate){}
}

class CalendarNotificationManager{
	public void AddEntry(CalendarEntry entry){}
	public void AddListener(NotificationListener listener);
	protected void NotifyAll(){}
	protected NotificationListener [] listeners;
}

public interface NotificationListener
{
	public void Notify(ReminderMessage message){}
}

fill in the blanks and I would request the senior Devs to please comment

- Anonymous September 17, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

abcd

- anon October 21, 2014 | 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