Problem Statement This problem is from Leetcode – Longest Common Prefix. The problem statement is as below: Given an array of strings, return the longest common prefix. If none, return an empty string. Solution Lets see the brute force approach: Lets see the code sample below: This code returns the following output: You can check […]
Palindrome Number – Leetcode #9
Problem Statement This problem is from Leetcode – Palindrome Number. The problem statement in short is as below: Check if an integer x is a palindrome; return true if it is, false if not. SOLUTION In this question we are given an integer. We need to check if its a palindrome or not. Approach Lets […]
Two Sum Problem – Leetcode #1
Problem Statement This problem is from Leetcode – Two Sum Problem. The problem statement is as below: Given an array and a target, return indices of two numbers that add up to the target. SOLUTION This question is asking us to find two numbers in the given array nums which add up to the given […]