原创 數組中最長的連續序列(longest consecutive sequence)
題目: Given an unsorted array of integers, find the length of the longest consecutive elements sequence. For exam
原创 MongoDB常用操作(二)
下載MongoDB 進到官網下載你需要的MondoDB版本,這裏我們現在mongodb-win32-x86_64-2008plus-ssl-3.2.13.zip這個版本。 安裝MongoDB 把下載後的zip壓縮包解壓,進入到
原创 MongoDB增刪改查(三)
Insert Documents 插入單個document到collection中. db.inventory.insertOne( { item: “canvas”, qty: 100, tags: [“cotto
原创 旋轉二維數組90度
題目 You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follo
原创 merge-intervals
題目描述 Given a collection of intervals, merge all overlapping intervals. For example, Given[1,3],[2,6],[8,10],
原创 二叉樹的最小深度
題目 Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path fr
原创 MongoDB簡介和基本概念(一)
NoSQL簡介 NoSQL(Not Only SQL ),意即“不僅僅是SQL” ,指的是非關係型的數據庫 。是一項全新的數據庫革命性運動,早期就有人提出,發展至2009年趨勢越發高漲。NoSQL的擁護者們提倡運用非關係型的數
原创 買賣股票 I II III
Best Time to Buy and Sell Stock I Description: Say you have an array for which the ith element is the price of a g
原创 (有序數組中移除重複元素)Remove Duplicates from Sorted Array
題目: Follow up for “Remove Duplicates”: What if duplicates are allowed at most twice? For example, Given s
原创 search-a-2d-matrix
題目描述 Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following prope
原创 remove-duplicates-from-sorted-array
題目描述 Given a sorted array, remove the duplicates in place such that each element appear only once and return the n
原创 remove element
題目描述 Given an array and a value, remove all instances of that value in place and return the new length. The ord
原创 Next Permutation
題目描述 Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of n
原创 JVM學習筆記(三)垃圾收集算法
Java虛擬機JVM垃圾收集算法有四種:標記-清除算法、複製算法、標記-整理算法以及分代收集算法。 標記-清除算法 這是JVM最基礎的垃圾收集算法。如下圖: 該算法分爲兩個階段:“標記”和“清除”。首先標記處所有需要回
原创 first-missing-positive
題目描述 Given an unsorted integer array, find the first missing positive integer. For example, Given[1,2,0]retu