LearnFrenzy
Sign in Take a free test

Arrays · Exercise 4 of 4

Arrays Array Programs

  • 8 questions
  • Page 1 of 1
  • Answers explained
0Attempted
0Correct
0Wrong
Directions

Interview-style array problems. Write each one yourself first, then open the solution – every solution was compiled and run, and the output shown is the real output. Tick "Mark as solved" to track your progress.

Question 1 Medium

Find the second largest distinct value in one pass. Report when there is none (all values equal).

Question page & discussion
Question 2 Medium

Rotate an array left by k positions in place, using O(1) extra memory.

Question page & discussion
Question 3 Medium

Given a sorted array, remove the duplicates in place and return the new length.

Question page & discussion
Question 4 Hard

Find the largest sum of a contiguous subarray, and print where it starts and ends.

Question page & discussion
Question 5 Medium

Search a sorted array. If the key is missing, report where it would be inserted.

Question page & discussion
Question 6 Easy

Merge two sorted arrays into a third sorted array.

Question page & discussion
Question 7 Medium

Multiply a 2 × 3 matrix by a 3 × 2 matrix.

Question page & discussion
Question 8 Medium

An array holds the numbers 1 to n with exactly one missing, in any order. Find the missing number without sorting and without risking overflow.

Question page & discussion
All exercises doneBack to ArraysRevise the concepts or pick another topic

Ready to test your Programming?

Timed online tests with instant scores and explanations.

Popular