Akamai Interview Question


Country: India
Interview Type: Phone Interview




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

Don't reinvent the wheel, put your data into a database and query your data using sql.

- cjudge@grandecom.net May 02, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

In scala i would use plain class list and filter function. Complexity is linear O(n)

type Exam = (String, Double)
  val subjectToSearch = "Math"
  val minimumPassing = 60.0
  case class Student(val id: String, val name: String, val age: Int, val exams: List[Exam]) {
  }

  val students = List[Student](
      Student("1", "1", 18, List(("English",20.34),("Math",84.5))),
      Student("2", "1", 18, List(("English",30.34),("History",74.5))),
      Student("3", "1", 18, List(("English",40.34),("History",64.5))),
      Student("4", "1", 18, List(("English",50.34),("History",54.5))),
      Student("5", "1", 18, List(("English",60.34),("Math",64.5))),
      Student("6", "1", 18, List(("English",70.34),("Math",34.5))),
      Student("7", "1", 18, List(("English",80.34),("History",24.5)))
  )   
  
  students.filter(curStudent => curStudent.exams.filter(exam => exam._2>minimumPassing && exam._1.equalsIgnoreCase(subjectToSearch)).size > 0)

- eko.harmawan.susilo May 17, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Create binary trees, one for each subject. The node contains a score, a set of students for that score, and children (which are nodes) for values below the score and above it.

class SubjectTree {

      int score;
      
      Set<Student> students = new Set<Student>();

      SubjectTree lesser;
      SubjectTree greater;

}

- Joe O September 12, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I'd go with Joe O's answer but I would add a hashtable to store each binary tree with the subject associated with it.

- Darryl January 30, 2018 | 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