0%

Add Binary – LeetCode 67

Problem

Description

Given two binary strings, return their sum (also a binary string).

Read more »

Plus One – LeetCode 66

Problem

Description

Given a non-negative integer represented as a non-empty array of digits, plus one to the integer.

You may assume the integer do not contain any leading zero, except the number 0 itself.

The digits are stored such that the most significant digit is at the head of the list.

Read more »

Length of Last Word – LeetCode 58

Problem

Description

Given a string s consists of upper/lower-case alphabets and empty space characters ‘ ‘, return the length of last word in the string.

If the last word does not exist, return 0.

Note: A word is defined as a character sequence consists of non-space characters only.

Read more »

Maximum Subarray – LeetCode 53

Problem

Description

Find the contiguous subarray within an array (containing at least one number) which has the largest sum.

Read more »

Count and Say – LeetCode 38

Problem

Description

The count-and-say sequence is the sequence of integers with the first five terms as following:

  1. 1
  2. 11
  3. 21
  4. 1211
  5. 111221
    1 is read off as “one 1” or 11.
    11 is read off as “two 1s” or 21.
    21 is read off as “one 2, then one 1” or 1211.
    Given an integer n, generate the nth term of the count-and-say sequence.

Note: Each term of the sequence of integers will be represented as a string.

Read more »

Search Insert Position – LeetCode 35

Problem

Description

Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.

You may assume no duplicates in the array.

Read more »

Implement strStr() – LeetCode 28

Problem

Description

Implement strStr().

Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.

Read more »

Remove Element – LeetCode 27

Problem

Description

Given an array and a value, remove all instances of that value in place and return the new length.

Do not allocate extra space for another array, you must do this in place with constant memory.

The order of elements can be changed. It doesn’t matter what you leave beyond the new length.

Read more »

Remove Duplicates from Sorted Array – LeetCode 26

Problem

Description

Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.

Do not allocate extra space for another array, you must do this in place with constant memory.

Read more »

Merge Two Sorted Lists – LeetCode 21

Problem

Description

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.

Read more »