原创 【小熊刷題】Two Sum

寫在前面 今天終於下定決心刷題了,先從已有答案的leetcode刷起。寫在這裏督促自己 :) Two Sum https://leetcode.com/problems/two-sum/ *Difficulty: Easy, F

原创 【小熊刷題】Binary Search Tree Iteration

Question Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root nod

原创 【小熊刷題】Convert Sorted List to Balanced Binary Search Tree

Question Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced B

原创 【小熊刷題】Remove Nth Node From End of List

Question Given a linked list, remove the nth node from the end of list and return its head. For example, Given link

原创 【小熊刷題】3 Sum

Question Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique t

原创 【小熊刷題】Longest Common Prefix

Question Write a function to find the longest common prefix string amongst an array of strings. *Difficulty: Easy

原创 【小熊刷題】3Sum Closest

Question Given an array S of n integers, find three integers in S such that the sum is closest to a given number, t

原创 【小熊刷題】Container with Most Water

Question Given n non-negative integers a1, a2, …, an, where each represents a point at coordinate (i, ai). n vertic

原创 【小熊刷題】Letter Combinations of a Phone Number

Question iven a digit string, return all possible letter combinations that the number could represent. A mapping of

原创 【小熊刷題】Best Time to Buy and Sell Stock I

看完書上不是premium的題了,正式開始刷題。 先來這個高頻的買賣股票的題 Question Say you have an array for which the ith element is the price of a g

原创 【小熊刷題】sqrt(x)

Question Implement int sqrt(int x). Compute and return the square root of x. **Difficulty: Medium https://leetcode

原创 【小熊刷題】Reverse Linked List

Question Reverse a singly linked list. *Difficulty: easy https://leetcode.com/problems/reverse-linked-list/ 沒啥好說的,

原创 【小熊刷題】Binary Tree Right Side View

Question Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you

原创 【小熊刷題】power of two, pow(x, n)

Question 1 Power of Two Given an integer, write a function to determine if it is a power of two. **Difficulty: Easy

原创 【小熊刷題】ZigZag Conversion

Question The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this: (you may w