Add office photos
Apple logo
Premium Employer

Apple

Verified
4.3
based on 543 Reviews
Video summary
Filter interviews by
Fresher
Experienced
Clear (1)

Apple Interview Questions and Answers for Freshers

Updated 10 Sep 2024

Q1. Kevin and his Fruits Problem Statement

Kevin has 'N' buckets, each consisting of a certain number of fruits. Kevin wants to eat at least 'M' fruits. He is looking to set a marker as high as possible such that i...read more

Ans.

Find the marker value needed for Kevin to eat at least 'M' fruits from 'N' buckets.

  • Iterate through each test case and calculate the marker value needed based on the number of fruits in each bucket.

  • Subtract the marker value from the number of fruits in each bucket and check if the total is at least 'M'.

  • Return the highest possible marker value for each test case.

View 1 answer
right arrow

Q2. Minimum Umbrellas Problem

You are provided with ‘N’ types of umbrellas, where each umbrella type can shelter a certain number of people. Given an array UMBRELLA that indicates the number of people each umbrella...read more

Ans.

Given 'N' types of umbrellas with different capacities, find the minimum number of umbrellas required to shelter exactly 'M' people.

  • Iterate through the umbrella capacities and try to cover 'M' people using the minimum number of umbrellas.

  • Keep track of the total number of people covered and the number of umbrellas used.

  • If it is not possible to cover 'M' people exactly, return -1.

  • Return the minimum number of umbrellas required to shelter exactly 'M' people.

Add your answer
right arrow

Q3. Lazy Santa Problem Statement

It's Christmas and Santa has 'K' gifts to distribute. There are 'N' children standing in a straight line in the park due to COVID restrictions. You are given an array distance conta...read more

Ans.

Find the minimum distance Santa must travel to distribute 'K' gifts to 'K' different children standing in a straight line.

  • Sort the array 'distance' to easily calculate the minimum distance Santa has to walk.

  • Calculate the difference between adjacent elements in the sorted array and sum the first 'K-1' differences to get the minimum distance.

  • Return the minimum distance Santa has to walk for each test case.

Add your answer
right arrow

Q4. Ninja and Candies Problem

Ninja, a boy from Ninjaland, receives 1 coin every morning from his mother. He wants to purchase exactly 'N' candies. Each candy usually costs 2 coins, but it is available for 1 coin i...read more

Ans.

Calculate the earliest day on which Ninja can buy all candies given the number of candy types, special offers, and Ninja's candy preferences.

  • Iterate through each day and check if any special offers are available for the candies Ninja wants to buy.

  • Keep track of the remaining candies Ninja needs to buy and the coins he has each day.

  • Consider both regular price and sale price while making purchases.

  • Return the earliest day on which Ninja can buy all candies.

Add your answer
right arrow
Discover Apple interview dos and don'ts from real experiences

Q5. Max GCD Pair Problem Statement

Given an array of positive integers, determine the Greatest Common Divisor (GCD) of a pair of elements such that it is the maximum among all possible pairs in the array. The GCD o...read more

Ans.

Find the maximum GCD of a pair of elements in an array of positive integers.

  • Iterate through all pairs of elements in the array to find their GCD.

  • Keep track of the maximum GCD found so far.

  • Use Euclidean algorithm to calculate GCD efficiently.

  • Return the maximum GCD value found.

Add your answer
right arrow

Q6. merge two sorted arrays to give a sorted array SV randomization constraints Code to generate sequence of powers of 2

Ans.

Merge two sorted arrays to give a sorted array and generate sequence of powers of 2 using SV randomization constraints.

  • Create a new array to store the merged result

  • Use two pointers to iterate through the two sorted arrays and compare elements

  • Add the smaller element to the new array and move the pointer for that array

  • Continue this process until all elements are merged

  • To generate sequence of powers of 2, use SV randomization constraints to create a random sequence of powers of ...read more

Add your answer
right arrow

Q7. What is the apple computer science

Add your answer
right arrow

Q8. No of islands(graph)

Ans.

Count the number of islands in a graph

  • Use Depth First Search (DFS) or Breadth First Search (BFS) to traverse the graph

  • Mark visited nodes to avoid revisiting them

  • Each connected component represents an island

Add your answer
right arrow

Q9. Reverse a string

Ans.

Reverse a string by iterating through the characters and swapping them

  • Create a function that takes a string as input

  • Initialize two pointers, one at the beginning and one at the end of the string

  • Swap the characters at the two pointers and move them towards the center until they meet

Add your answer
right arrow
Contribute & help others!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos

Interview Process at Apple for Freshers

based on 12 interviews
Interview experience
4.5
Good
View more
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Interview Questions from Similar Companies

Deloitte Logo
3.8
 • 1.7k Interview Questions
Genpact Logo
3.8
 • 1.5k Interview Questions
Hexaware Technologies Logo
3.5
 • 383 Interview Questions
UBS Logo
3.9
 • 246 Interview Questions
HSBC Group Logo
3.9
 • 245 Interview Questions
Startek Logo
3.1
 • 178 Interview Questions
View all
Recently Viewed
LIST OF COMPANIES
Stratosphere IT Services
Locations
LIST OF COMPANIES
Affluent Global Services
Locations
SALARIES
Avendus
SALARIES
Avendus
SALARIES
Cybage
DESIGNATION
LIST OF COMPANIES
VSynergize Outsourcing
Locations
SALARIES
Micron Technology
SALARIES
NXP Semiconductors
JOBS
Apollo Global Management
No Jobs
Top Apple Interview Questions And Answers
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter