原创 【Java基礎】a+=1與a=a+1
偶然在某個地方看到這個問題,第一反應是兩者是有區別的,但是要說的很詳細,一時又想不起來。所以在此記錄下來。 首先,java中整數的默認類型是int型,浮點數的默認類型是double型。 數值的轉換分爲隱式轉換和顯式轉換,隱式轉換即jvm幫
原创 LeetCode(70)——Climbing Stairs
題目: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. I
原创 LeetCode(26)——Remove Duplicates from Sorted Array
題目:Given a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new
原创 LeetCode(67)——Add Binary
題目: Given two binary strings, return their sum (also a binary string). The input strings are both non-empty and contain
原创 LeetCode(237)——Delete Node in a Linked List
題目:Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed
原创 LeetCode(53)——Maximum Subarray
題目: Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest su
原创 LeetCode(58)——Length of Last Word
題目: Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last w
原创 LeetCode(15)——3Sum
題目:Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique tripl
原创 LeetCode(69)——Sqrt(x)
題目: Implement int sqrt(int x). Compute and return the square root of x, where x is guaranteed to be a non-negative inte
原创 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 it
原创 LeetCode(27)——Remove Element
題目: Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not
原创 LeetCode(41)——First Missing Positive
Given an unsorted integer array, find the smallest missing positive integer. Example 1: Input: [1,2,0] Output: 3 Exam
原创 LeetCode(66)——Plus One
題目: Given a non-empty array of digits representing a non-negative integer, plus one to the integer. The digits are stor
原创 LeetCode(14)——Longest Common Prefix
題目:Write a function to find the longest common prefix string amongst an array of strings.If there is no common prefix,
原创 LeetCode(24)——Swap Nodes in Pairs
題目:Given a linked list, swap every two adjacent nodes and return its head.Example:Given 1->2->3->4, you should return t