Single Number – Leetcode #136

Problem Statement This problem is from Leetcode – Single Number. The problem statement is as below: Given a non-empty array of integers nums, every element appears twice except for one. Find that single one. You must implement a solution with a linear runtime complexity and use only constant extra space. Solution This problem is asking us to figure out […]

Valid Palindrome – Leetcode #125

Problem Statement This problem is from Leetcode – Valid Palindrome. The problem statement is as below: A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers. Given a string s, return true if […]

Longest Uniform Sub-String

Problem Statement Given a string, find the longest uniform sub-string in it. Return the repeating character and the number of times it repeats. Solution Let us take an example string like “abcdddss“. The question is asking us to return the longest sub-string with the same characters. In this case the longest uniform sub-string is “ddd”. […]

The Two Egg Problem

Problem Statement The two egg problem is as follows: there is a building with 100 floors. You are given 2 identical eggs. How do you use 2 eggs to find the threshold floor, where the egg will definitely break from any floor above floor N, including floor N itself. Solution Note that: Approach – 1 […]

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top