原创 [Leetcode 143, Medium] Reorder List

Problem: iven a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-pl

原创 [Leetcode 239, Hard] Sliding Window Maximum

Problem: Given an array nums, there is a sliding window of size k which is moving from the very left of the array to

原创 [Leetcode 35, Medium] Search Insert Position

Problem: Given a sorted array and a target value, return the index if the target is found. If not, return the index w

原创 [Leetcode 154, Hard] Find Minimum in Rotated Sorted Array II

Problem: Follow up for "Find Minimum in Rotated Sorted Array": What if duplicates are allowed? Would this affect the

原创 [Leetcode 150, Medium] Evaluate Reverse Polish Notation

Problem: Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /.

原创 C++ outline and interview questions (3): Class

3.1. Contents 3.1.1 The main features of C++. (1) Encapsulation: access control. (2) Inherence: some attributes (member

原创 [Leetcode 241, Medium] Different Ways to Add Parentheses

Problem: Given a string of numbers and operators, return all possible results from computing all the different possib

原创 [4, Hard, C++] Median of Two Sorted Arrays

Problem: There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted a

原创 [1, Medium, C++] Two Sum

Problem: Given an array of integers, find two numbers such that they add up to a specific target number. The functio

原创 [3, Medium, C++] Longest Substring Without Repeating Characters

Problem: Given a string, find the length of the longest substring without repeating characters. For example, the longes

原创 [Leetcode 47, Hard] Permutations II

Problem: Given a collection of numbers that might contain duplicates, return all possible unique permutations. For e

原创 [Leetcode 233, Medium] Number of Digit One

Problem: Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or eq

原创 [Leetcode 216, Medium] Combination sum III

Problem: Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9

原创 [2, Medium, C++] Add Two Numbers

Problem: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order

原创 [Leetcode 137, Medium] Single Number II

Problem: Given an array of integers, every element appears three times except for one. Find that single one. Note: Y