0%

Maximum Subarray

LeetCode - 0053 Maximum Subarray
https://leetcode.com/problems/maximum-subarray/

Problem Description

Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.

Example:

Input: [-2, 1, -3, 4, -1, 2, 1, -5, 4]
Output: 6
Explanation: [4, -1, 2, 1] has the largest sum = 6.

Follow up:
If you have figured out the O(n) solution, try coding another solution using the divide and conquer approach, which is more subtle.

Read more »

Merge Two Sorted Lists

LeetCode - 0021 Merge Two Sorted Lists
https://leetcode.com/problems/merge-two-sorted-lists/

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.

Example:

Input: 1->2->4, 1->3->4
Output: 1->1->2->3->4->4
Read more »

Valid Parentheses

LeetCode - 0020 Valid Parentheses (Easy)
https://leetcode.com/problems/valid-parentheses/

Problem Description

Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[‘ and ‘]’, determine if the input string is valid.

An input string is valid if:

  1. Open brackets must be closed by the same type of brackets.
  2. Open brackets must be closed in the correct order.

Note that an empty string is also considered valid.

Read more »

Two Sum

LeetCode - 0001 Two Sum (Easy)
https://leetcode.com/problems/two-sum/

Problem Description

Given an array of integers, return indices of the two numbers such that they add up to a specific target.

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

Example:

1
2
3
4
Given nums = [2, 7, 11, 15], target = 9,

Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1].
Read more »

Goal

To enable HTTPS and obtain SSL/TLS certificate by Let’s Encrypt for Google Cloud VM.

References: