原创 LeeyCode - 167. Two Sum II - Input array is sorted
題目: Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a
原创 LeetCode - 35. Search Insert Position
題目: Given a sorted array and a target value, return the index if the target is found. If not, return the index where i
原创 LeetCode - 141. Linked List Cycle
題目: Given a linked list, determine if it has a cycle in it. 思路與步驟: 採用“快慢指針”查檢查鏈表是否含有環。讓一個指針一次走一步,另一個一次走兩步,如果鏈表中含有環,快指
原创 LeetCode - 67. Add Binary
題目: Given two binary strings, return their sum (also a binary string). 思路與步驟: 原思路: 將兩個string逐個字符相加,設置一個flag ,進位的話記 car
原创 LeetCode - 125. Valid Palindrome
題目: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. 思路與步
原创 LeetCode - 189. Rotate Array
題目: Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7
原创 LeetCode - 20. Valid Parentheses
題目: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is va
原创 leetCode - 459. Repeated Substring Pattern
題目: Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies o
原创 LeetCode - 520. Detect Capital
題目: Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capital
原创 LeetCode - 434. Number of Segments in a String
題目: Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space char
原创 LeetCode - 66. Plus One
題目: Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may assume th
原创 LeetCode - 349. Intersection of Two Arrays
題目: Given two arrays, write a function to compute their intersection. Example: Given nums1 = [1, 2, 2, 1], nums2 = [2,
原创 LeetCode - 13. Roman to Integer
題目: Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 思路與步驟
原创 LeetCode - 28. Implement strStr()
題目: Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part o
原创 LeetCode - 383. Ransom Note
題目: Given an arbitrary ransom note string and another string containing letters from all the magazines, write a functi