8 xdhc304



TA的排名 6k+

1331. Rank Transform of an Array

Given an array of integers arr, replace each element with its rank.The rank represents how large the element is. The rank has the following rules:Rank is an integer starting from 1.The larger the e...

2020-02-05 23:01:52

1160. Find Words That Can Be Formed by Characters

You are given an array of strings words and a string chars.A string is good if it can be formed by characters from chars (each character can only be used once).Return the sum of lengths of all good ...

2020-02-05 22:03:46


const _max = Math.max.bind(Math);const _min = Math.min.bind(Math);const _pow = Math.pow.bind(Math);const _floor = Math.floor.bind(Math);const _round = Math.round.bind(Math);const _ceil = Math.cei...

2020-02-03 15:39:05

884. Uncommon Words from Two Sentences

We are given two sentences A and B. (A sentence is a string of space separated words. Each word consists only of lowercase letters.)A word is uncommon if it appears exactly once in one of the sente...

2020-02-02 20:06:09

149. Max Points on a Line

Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.Example 1:Input: [[1,1],[2,2],[3,3]]Output: 3Explanation:^|| o| o| o +--------...

2020-01-30 16:25:11


// 判断变量否为function const isFunction = variable => typeof variable === 'function' // 定义Promise的三种状态常量 const PENDING = 'PENDING' const FULFILLED = 'FULFILLED' const REJECTED = 'REJECTED'...

2020-01-19 10:28:52

232. Implement Queue using Stacks

Implement the following operations of a queue using stacks.push(x) – Push element x to the back of queue.pop() – Removes the element from in front of queue.peek() – Get the front element.empty() ...

2020-01-18 16:05:09

208. Implement Trie (Prefix Tree)

Implement a trie with insert, search, and startsWith methods.Example:Trie trie = new Trie();trie.insert("apple");trie.search("apple"); // returns truetrie.search("app"); // returns falset...

2020-01-12 16:38:41

137. Single Number II

Given a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one.Note:Your algorithm should have a linear runtime complexity. C...

2019-12-15 15:57:41


#! python 3# -*- coding:utf-8 -*-'''Copy指定格式的文件到新文件夹'''import shutil,os,send2trash#定义函数,接收传入的值def SFileToDFile(sourcefile,fileclass,destinationfile): #遍历目录和子目录 for filenames in os.listd...

2019-11-26 15:21:47


#! python 3# -*- coding:utf-8 -*-# Autor: Li Rong Yang'''Copy指定格式的文件到新文件夹'''import shutil,os#定义函数,接收传入的值def SFileToDFile(sourcefile,fileclass,destinationfile): #遍历目录和子目录 for filenames ...

2019-11-26 15:20:04

103. Binary Tree Zigzag Level Order Traversal

Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right, then right to left for the next level and alternate between).For example:Given binary tree...

2019-11-24 14:11:02

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 integer.Since the return type is an integer, the decimal digits are truncated and only t...

2019-10-28 16:55:20

58. Length of Last Word

Given a string s consists of upper/lower-case alphabets and empty space characters ’ ', return the length of last word in the string.If the last word does not exist, return 0.Note: A word is defined...

2019-10-23 23:42:27

53. Maximum Subarray

Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.Example:Input: [-2,1,-3,4,-1,2,1,-5,4],Output: 6Explanation:...

2019-10-22 22:39:11

49. Group Anagrams

Given an array of strings, group anagrams together.Example:Input: ["eat", "tea", "tan", "ate", "nat", "bat"],Output:[ ["ate","eat","tea"], ["nat","tan"], ["bat"]]Note:All inputs will be ...

2019-10-21 23:04:36

39. Combination Sum

Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.The same repeate...

2019-10-19 21:48:50

34. Find First and Last Position of Element in Sorted Array

Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.Your algorithm’s runtime complexity must be in the order of O(log n).If the t...

2019-10-18 22:49:34


wget https://vscode-update.azurewebsites.net/latest/linux-deb-x64/stable -O /tmp/code_latest_amd64.debsudo dpkg -i /tmp/code_latest_amd64.deb

2019-10-01 22:34:47

16. 3Sum Closest

Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would ...

2019-09-28 21:35:41


勋章 我的勋章
  • 持之以恒
  • 勤写标兵Lv2