iOS Interview Prep Guide: 30-Day Code Challenge in Swift — Week 4/5
Here comes the fourth week of the challenge. Keep grinding. If you need to catch up a bit, you can find challenges of the previous weeks here — Week 1, Week 2, and Week 3
Also, feel free to utilize my Github repo that includes a solution and unit tests for each coding question of the code challenge.
In this article, we’ll discuss the following 7 programming questions from week 4 of the code challenge.
- Subarray Sum Equals K (Solution) 🥇
- Bitwise AND of Numbers Range (Solution)
- LRU Cache (Solution)
- Jump Game (Solution)
- Longest Common Subsequence (Solution) 🥉
- Maximal Square (Solution) 🥈
- First Unique Number (Solution)
(🥇 🥈 🥉 indicate writer’s selection of high-frequency interview questions.)
Subarray Sum Equals K
🥇 Writer’s selection of the week
Description: Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals k.
Example Input:nums = [1, 1, 1], k = 2
Output: 2