Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding Ninjas X Naukri.com
Apple interview experience Real time questions & tips from candidates to crack your interview

Intern

Apple
upvote
share-icon
2 rounds | 3 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 6 Months
Topics: C, C++, Java Data Structures, Pointers, OOPS, System Design, Algorithms, Dynamic Programming, Operating System, Networking
Tip
Tip

Tip 1 : Must do Previously asked Interviews Questions.
Tip 2 : Prepare OS, DBMS, OOPs, Computer Networks well.
Tip 3 : Prepare well for one project mentioned in the resume, the interviewer may ask any question related to the project, especially about the networking part of the project.

Application process
Where: Referral
Eligibility: None
Resume Tip
Resume tip

Tip 1 : Have at least 2 good projects mentioned in your resume with a link
Tip 2 : Focus on skills, internships, projects, and experiences.
Tip 3 : Make it simple, crisp, and one page
Tip 4 : Only write those skills in which you are good.

Interview rounds

01
Round
Medium
Video Call
Duration120 Minutes
Interview date1 Sep 2019
Coding problem2

This was 1st technical round taken by the software engineer at Apple. Interviewer was very friendly, he started with his introduction and then asked me to introduce myself.

1. Gas Stations

Moderate
10m average time
90% success
0/80
Asked in companies
OlaFlipkartPhone Pe

You have been given a circular path. There are 'N' petrol pumps on this path that are numbered from 0 to N - 1 (Both inclusive). Each petrol pump has two values associated with it:

1)The amount of petrol that is available at this particular petrol pump.
2)The distance to reach the next petrol pump.

You are on a truck having an empty tank of infinite capacity. You can start the tour from any of the petrol pumps. Your task is to calculate the first petrol pump from where the truck will be able to complete the full circle or determine if it is impossible to do so.

You may assume that the truck will stop at every petrol pump and it will add the petrol from that pump to its tank. The truck will move one kilometre for each litre of petrol consumed.

Problem approach

C++ Solution

int canCompleteCircuit(vector& gas, vector& cost) {
int balance = 0;
int defi = 0;
int start = 0;
for(int i = 0;i=0) return start;
return -1;
}

Try solving now

2. Longest Substring Without Repeating Characters

Moderate
30m average time
65% success
0/80
Asked in companies
SliceCognizantOLX Group

Given a string input of length n, find the length of the longest substring without repeating characters i.e return a substring that does not have any repeating characters.

Substring is the continuous sub-part of the string formed by removing zero or more characters from both ends.

Problem approach

C++ solution ||using sliding window || TC : O(2n)

class Solution {
public:
int lengthOfLongestSubstring(string s) {
int n = s.size();
int len = 0;
int l = 0, r = 0;
unordered_set st;
while (r < n)
{
if (st.find(s[r])== st.end()) 
st.insert(s[r]);
else {
while (st.find(s[r]) != st.end()) {
st.erase(s[l]);
l++;
}
st.insert(s[r]);

len = max(len, r - l + 1);
r++;
}
return len;
}
};

Try solving now
02
Round
Medium
Video Call
Duration60 Minutes
Interview date1 Sep 2019
Coding problem1

It was the second technical round taken by the senior software developer. During the interview, the interviewer was very friendly and helpful whenever I had any questions. I was asked to introduce myself after he gave his introduction.

1. Candies

Moderate
10m average time
90% success
0/80
Asked in companies
Goldman SachsOYOFlipkart

Prateek is a kindergarten teacher. He wants to give some candies to the children in his class. All the children stand in a line and each of them has a grade according to his or her performance in the class. Prateek wants to give at least one candy to each child. If two children are standing adjacent to each other, then the one with the higher rating must get more candies than the other. Prateek wants to minimize the total number of candies he must buy.

Given an array 'STUDENTS' of size 'N' that contains the grades for each student, your task is to find what is the minimum number of candies Prateek must buy so that he can distribute them among his students according to the criteria given above.

Example :

Given students' ratings : [5, 8, 1, 5, 9, 4]. 
He gives the students candy in the following minimal amounts : [1, 2, 1, 2, 3, 1]. He must buy a minimum of 10 candies.

Note :

1. If two students having the same grade are standing next to each other, they may receive the same number of candies.
2. Every student must get at least a candy.
Try solving now

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

How do you write a single-line comment in C++?

Choose another skill to practice
Start a Discussion
Similar interview experiences
company logo
SDE - Intern
2 rounds | 3 problems
Interviewed by Apple
2234 views
0 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 4 problems
Interviewed by Apple
6768 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 4 problems
Interviewed by Apple
1857 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 6 problems
Interviewed by Apple
1363 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Intern
2 rounds | 2 problems
Interviewed by Microsoft
908 views
0 comments
0 upvotes
company logo
Intern
2 rounds | 2 problems
Interviewed by Adobe
636 views
0 comments
0 upvotes
company logo
Intern
3 rounds | 4 problems
Interviewed by Oracle
863 views
0 comments
0 upvotes