3Sum LeetCode Solution
Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
3Sum LeetCode Solution Read More »
Leetcode SolutionGiven an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
3Sum LeetCode Solution Read More »
Leetcode SolutionGiven a string s, return the longest palindromic substring in s. A palindrome is a string which reads the same in both directions. For example, S = “aba” is a palindrome, S = “abc” is not.
Longest Palindromic Substring LeetCode Solution Read More »
Leetcode SolutionGiven a string s which represents an expression, evaluate this expression and return its value. The integer division should truncate toward zero.
Basic Calculator II LeetCode Solution Read More »
Leetcode SolutionYou are given an integer array nums and two integers indexDiff and valueDiff. Find a pair of indices (i, j) such that: i != j, abs(i – j) <= indexDiff. abs(nums[i] - nums[j]) <= valueDiff, and Return true if such pair exists or false otherwise.
Contains Duplicate III LeetCode Solution Read More »
Leetcode SolutionGiven an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.
Contains Duplicate LeetCode Solution Read More »
Leetcode SolutionGiven an m x n binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area.
Maximal Square LeetCode Solution Read More »
Leetcode SolutionGiven an m x n board of characters and a list of strings words, return all words on the board.
Word Search II LeetCode Solution Read More »
Leetcode SolutionGiven an array nums of size n, return the majority element. The majority element is the element that appears more than [n / 2] times. You may assume that the majority element always exists in the array.
Majority Element LeetCode Solution Read More »
Leetcode SolutionGiven an integer array nums and an integer k, return true if there are two distinct indices i and j in the array such that nums[i] == nums[j] and abs(i – j) <= k.
Contains Duplicate II LeetCode Solution Read More »
Leetcode SolutionWrite an algorithm to determine if a number n is happy. Return true if n is a happy number, and false if not.
Happy Number LeetCode Solution Read More »
Leetcode SolutionGiven an integer array nums representing the amount of money of each house, return the maximum amount of money you can rob tonight without alerting the police.
House Robber LeetCode Solution Read More »
Leetcode SolutionReverse bits of a given 32 bits unsigned integer.
Reverse Bits LeetCode Solution Read More »
Leetcode SolutionGiven the heads of two singly linked-lists headA and headB, return the node at which the two lists intersect. If the two linked lists have no intersection at all, return null.
Intersection of Two Linked Lists LeetCode Solution Read More »
Leetcode SolutionGiven a non-empty array of integers nums, every element appears twice except for one. Find that single one.
Single Number LeetCode Solution Read More »
Leetcode SolutionGiven the head of a singly linked list where elements are sorted in ascending order, convert it to a height-balanced binary search tree.
Convert Sorted List to Binary Search Tree LeetCode Solution Read More »
Leetcode Solution