原创 153. Find Minimum in Rotated Sorted Array

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7

原创 尋找旋轉排序數組中的最小值 II

假設一個旋轉排序的數組其起始位置是未知的(比如0 1 2 4 5 6 7 可能變成是4 5 6 7 0 1 2)。 你需要找到其中最小的元素。 數組中可能存在重複的元素。 樣例 給出[4,4,5,6,7,0,1,2] 返回

原创 397. Integer Replacement

Given a positive integer n and you can do operations as follow: If n is even, replace n with n/2. If n is odd, yo

原创 翻轉鏈表 II

翻轉鏈表中第m個節點到第n個節點的部分 樣例 給出鏈表1->2->3->4->5->null, m = 2 和n = 4,返回1->4->3->2->5->null 挑戰 在原地一次翻轉完成 /** * Definiti

原创 刪除鏈表中倒數第n個節點

給定一個鏈表,刪除鏈表中倒數第n個節點,返回鏈表的頭節點。 樣例 給出鏈表1->2->3->4->5->null和 n = 2. 刪除倒數第二個節點之後,這個鏈表將變成1->2->3->5->null. 挑戰 O(n)時間

原创 445. Add Two Numbers II

You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes f

原创 218. The Skyline Problem

A city’s skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a

原创 419. Battleships in a Board

Given an 2D board, count how many battleships are in it. The battleships are represented with ‘X’s, empty slots are

原创 138. Copy List with Random Pointer

A linked list is given such that each node contains an additional random pointer which could point to any node in t

原创 73. Set Matrix Zeroes

Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. click to show follow

原创 xgboost

摘錄自知乎。https://www.zhihu.com/question/41354392 xgboost和gbdt的區別,爲什麼快?如何支持並行? 1.傳統gbdt是用CART作爲基分類器,xgboost還支持線性分類器。此時

原创 151. Reverse Words in a String

Given an input string, reverse the string word by word. For example, Given s = “the sky is blue”, return “blue is

原创 273. Integer to English Words

Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 231 -

原创 機器學習-1

基本問題的經典算法 分類:svm、最大熵、adaboost、分類迴歸樹、隨機森林 迴歸:分類迴歸樹、隨機森林、GBDT 排序:GBRank 聚類:K-Means 結構標註:隱馬爾可夫模型、條件隨機場。 機器學習=表示(算

原创 268. Missing Number

Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.