# Coding Interviews

## Project Euler 8: Largest product in a series

Problem The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832. Find the thirteen adjacent digits in the 1000-digit number that have the greatest product. What is the value of this product? Official Problem Solution Approach In this problem of the Largest […]

## Project Euler 7: 10001st prime

Problem By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10001st prime number? Official Problem Solution Approach In this problem of the 10001st prime, we have to find the 10001st prime number. A prime number is a natural

## Project Euler 6: Sum Square Difference

Problem The sum of the squares of the first ten natural numbers is, 12+22+…+102=385 The square of the sum of the first ten natural numbers is, (1+2+…+10)2=552=3025 Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025−385=2640. Find the difference between the

## Project Euler 5: Smallest Multiple

Problem 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? Official Problem Solution Approach In this problem of smallest multiple, we have to find the smallest

## Leetcode 409: Longest Palindrome | Leetcode Easy

Category: Easy Problem Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters. Letters are case sensitive, for example, “Aa” is not considered a palindrome here. Problem Link. Examples Example 1: Example 2: Constraints 1 <= s.length <= 2000 s consists of lowercase and/or uppercase English letters only. Solution Approach In this

## Leetcode 1672: Richest Customer Wealth

Category: Easy Problem You are given an m x n integer grid accounts where accounts[i][j] is the amount of money the i​​​​​​​​​​​th​​​​ customer has in the j​​​​​​​​​​​th​​​​ bank. Return the wealth that the richest customer has. A customer’s wealth is the amount of money they have in all their bank accounts. The richest customer is the customer that has the maximum wealth. Problem Link. Examples Example 1: Example 2: Constraints

## Project Euler 4: Largest palindrome product

Problem A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers. Official Problem Solution Approach In this problem of the Largest palindrome product, we have to find the

## Leetcode 136: Single Number

Category: Easy Problem Given a non-empty array of integers nums, every element appears twice except for one. Find that single one. Follow up: Could you implement a solution with a linear runtime complexity and without using extra memory? Problem Link. Examples Example 1: Example 2: Constraints 1 <= nums.length <= 3 * 104 -3 * 104 <= nums[i] <= 3 * 104

## Leetcode 27: Remove Element

Category: Easy Problem Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. The order of elements can be changed. It doesn’t matter what you leave beyond the new length. https://leetcode.com/problems/remove-element Examples Example

## Project Euler 3: Largest prime factor

Problem The prime factors of 13195 are 5, 7, 13, and 29. What is the largest prime factor of the number 600851475143 ? Official Problem Solution Approach In this problem, we are supposed to find the largest prime number which divides the given number. We will use a basic mathematics theorem called the “fundamental theorem