0%

Excel Sheet Column Number – LeetCode 171

Problem

Description

Given a column title as appear in an Excel sheet, return its corresponding column number.

Read more »

Two Sum III - Data structure design – LeetCode 170

Problem

Description

Design and implement a TwoSum class. It should support the following operations:add and find.

add - Add the number to an internal data structure.

find - Find if there exists any pair of numbers which sum is equal to the value.

Read more »

Majority Element – LeetCode 169

Problem

Description

Given an array of size n, find the majority element. The majority element is the element that appears more than n/2 times.

Read more »

Excel Sheet Column Title – LeetCode 168

Problem

Description

Given a positive integer, return its corresponding column title as appear in an Excel sheet.

Read more »

Two Sum II - Input array is sorted – LeetCode 167

Problem

Description

Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.

The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2. Please note that your returned answers (both index1 and index2) are not zero-based.

You may assume that each input would have exactly one solution and you may not use the same element twice.

Read more »

Intersection of Two Linked Lists – LeetCode 160

Problem

Description

Write a program to find the node at which the intersection of two singly linked lists begins.

Read more »

Min Stack – LeetCode 155

Problem

Description

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.

  • push(x) – Push element x onto stack.

  • pop() – Removes the element on top of the stack.

  • top() – Get the top element.

  • getMin() – Retrieve the minimum element in the stack.

Read more »

Isomorphic Strings – LeetCode 205

Problem

Description

Given two strings s and t, determine if they are isomorphic.

Two strings are isomorphic if the characters in s can be replaced to get t.

All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character but a character may map to itself.

Read more »

Count Primes – LeetCode 204

Problem

Description

Count the number of prime numbers less than a non-negative number, n.

Read more »

Remove Linked List Elements – LeetCode 203

Problem

Description

Remove all elements from a linked list of integers that have value val.

Read more »