原创 Leetcode643 Maximum Average Subarray I

題目 Given an array consisting of n integers, find the contiguous subarray of given length k that has the maximum aver

原创 Leetcode260 Single Number III

題目 Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear

原创 Leetcode70 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. In

原创 Leetcode553 Optimal Division

題目 Given a list of positive integers, the adjacent integers will perform the float division. For example, [2,3,4] ->

原创 javascript之單線程

javascript的單線程機制 爲什麼javascript採用單線程機制?         先說明一下線程和進程的不同:進程是執行的應用程序,每個進程都是由私有的虛擬地址空間、代碼、數據和其它系統資源所組成,進程在運行過程中能夠申請創

原创 javascript之BOM的location對象

location對象 location是最有用的 BOM 對象之一,它提供了與當前窗口中加載的文檔有關的信息,還提供了一些導航功能。  location對象是很特別的一個對象,因爲它既是 window對象的屬性,也是document 對象

原创 Leetcode172 Factorial Trailing Zeroes

題目 Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time

原创 java多線程:基礎原理

java多線程:基礎原理 java支持多線程編程,爲了能夠深入理解java多線程機制,以及解決多線程的安全問題,本文介紹多線程的基礎知識和原理分析。 Part1 概念總結 線程的概念 線程(Thread)是操作系統能夠進行運算調度的最

原创 leetcode121 Best Time to Buy and Sell Stock

問題描述Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted t

原创 Leetcode661 Image Smoother

題目Given a 2D integer matrix M representing the gray scale of an image, you need to design a smoother to make the gray s

原创 Leetcode724 Find Pivot Index(數組的中間下標)

題目Given an array of integers nums, write a method that returns the "pivot" index of this array.We define the pivot inde

原创 Leetcode747 Min Cost Climbing Stairs(爬樓梯的最小代價)

題目:On a staircase, the i-th step has some non-negative cost cost[i] assigned (0 indexed).Once you pay the cost, you can

原创 java之樹的遍歷

樹的深度優先遍歷和廣度優先遍歷 深度優先遍歷(Depth First Search,DFS)和廣度優先遍歷(Breadth First Search,BFS)是兩種遍歷樹中元素的方式。 深度優先遍歷(DFS): 對於上述tree來說,D

原创 Leetcode130 Surrounded Regions

題目Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'.A region is captured by

原创 Leetcode628 Maximum Product of Three Numbers

題目Given an integer array, find three numbers whose product is maximum and output the maximum product.Example 1:Input: [