All Posts

Leetcode 215: Kth Largest Element in an Array

Given an array of integers, find the kth largest element without sorting the entire array.

Leetcode 217: Contains Duplicate

Given an array of integers, determine if there are any duplicate values present. Return true if any value appears more than once, otherwise return false.

Leetcode 228: Summary Ranges

You are given a sorted array of unique integers. Your task is to group consecutive numbers into ranges and return a sorted list of these ranges. A range [a,b] includes all integers from a to b (inclusive). Each range should be represented as ‘a->b’ if a != b or ‘a’ if a == b.

Leetcode 229: Majority Element II

Given an integer array, find all elements that appear more than ⌊n/3⌋ times, where n is the length of the array. Your task is to return a list of all such elements.

Leetcode 238: Product of Array Except Self

Given an integer array, your task is to return an array where each element at index ‘i’ is the product of all the elements of the original array except the element at index ‘i’. You are not allowed to use division in your solution, and the algorithm must run in O(n) time.

Leetcode 268: Missing Number

Given an array nums containing n distinct numbers, each in the range [0, n], return the only number in the range that is missing from the array.