8 taoqick

尚未进行身份认证

暂无相关简介

等级
TA的排名 6k+

Leetcode 398. Random Pick Index

Given an array of integers with possible duplicates, randomly output the index of a given target number. You can assume that the given target number must exist in the array.Note:The array size can ...

2020-02-23 17:39:30

Leetcode 336. Palindrome Pairs

Given a list ofuniquewords, find all pairs ofdistinctindices(i, j)in the given list, so that the concatenation of the two words, i.e.words[i] + words[j]is a palindrome.Example 1:Input: ["...

2020-02-23 17:22:01

Leetcode 928. Minimize Malware Spread II

(This problem is the same asMinimize Malware Spread, with the differences bolded.)In a network of nodes, each nodeiis directly connected to another nodejif and only ifgraph[i][j] = 1.Some no...

2020-02-22 17:17:31

Leetcode 839. Similar String Groups 并查集

Two stringsXandYare similar if we can swap two letters (in different positions) ofX, so thatit equalsY. Also two stringsXandYare similar if they are equal.For example,"tars"and"rats"a...

2020-02-18 22:54:50

Leetcode 519. Random Flip Matrix

You are given the number of rowsn_rowsand number of columnsn_colsof a2Dbinary matrixwhere all values are initially 0.Write a functionflipwhich choosesa 0 valueuniformly at random,changes ...

2020-02-16 16:39:22

Leetcode 1005. Maximize Sum Of Array After K Negations

Given an arrayAof integers, wemustmodify the array in the following way: we choose aniand replaceA[i]with-A[i], and we repeat this processKtimes in total. (We may choose the same indexim...

2020-02-15 23:26:54

Leetcode 1105. Filling Bookcase Shelves

We have a sequence ofbooks: thei-th book has thicknessbooks[i][0]and heightbooks[i][1].We want to place these booksin orderonto bookcase shelves that have total widthshelf_width.We choose...

2020-02-15 22:36:13

Leetcode 352. Data Stream as Disjoint Intervals

Given a data stream input of non-negative integers a1, a2, ..., an, ..., summarize the numbers seen so far as a list of disjoint intervals.For example, suppose the integers from the data stream are ...

2020-02-13 15:43:00

Leetcode 1278. Palindrome Partitioning III

You are given a stringscontaining lowercase letters and an integerk. You need to :First, change some characters ofsto other lowercase English letters. Then dividesintoknon-empty disjoint s...

2020-02-12 10:21:43

Leetcode Is Graph Bipartite?

Given an undirectedgraph, returntrueif and only if it is bipartite.Recall that a graph isbipartiteif we can split it's set of nodes into two independentsubsets A and B such that every edge in ...

2020-02-10 16:24:46

Leetcode Contain Virus

A virus is spreading rapidly, and your task is to quarantine the infected area by installing walls.The world is modeled as a 2-D array of cells, where0represents uninfected cells, and1represents...

2020-02-10 14:06:10

Leetcode 220. Contains Duplicate III 桶排序

Given an array of integers, find out whether there are two distinct indicesiandjin the array such that theabsolutedifference betweennums[i]andnums[j]is at mosttand theabsolutedifference ...

2020-02-09 13:51:31

编程之美NIM(2)游戏分析扩展问题

问题:有N块石头和两个玩家A和B,玩家A先将石头随机分成若干堆,然后按照BABA...的顺序不断轮流取石头,能将剩下的石头一次取光的玩家获胜,每次取石头时,每个玩家只能从若干堆石头中任选一堆,取这一堆石头中任意数目(大于0)个石头。请问:玩家A要怎样分配和取石头才能保证自己有把握取胜?如果石头的个数N为偶数,A只要将其分为相同的两份,就一定能取胜。初始:XOR(M1, M1) == 0...

2020-02-08 17:55:48

Leetcode Circular Permutation in Binary Representation 格雷码 gray code

Given 2 integersnandstart. Your task is returnanypermutationpof(0,1,2.....,2^n -1)such that :p[0] = start p[i]andp[i+1]differ by only one bit in their binary representation. p[0]andp...

2020-02-08 16:06:31

Leetcode Reconstruct Itinerary

Given a list of airline tickets represented by pairs of departure and arrival airports[from, to], reconstruct the itinerary in order. All of the tickets belong to a man who departs fromJFK. Thus, th...

2020-02-02 23:13:35

Leetcode Remove Sub-Folders from the Filesystem

Given a list of folders, remove all sub-folders in those folders and return inany orderthe folders after removing.If afolder[i]is located withinanotherfolder[j], it is called asub-folderof i...

2020-02-01 17:50:07

Leetcode Maximum XOR of Two Numbers in an Array

Given anon-emptyarray of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai< 231.Find the maximum result of aiXOR aj, where 0 ≤i,j<n.Could you do this in O(n) runtime?Example:Input: [3...

2020-02-01 11:51:39

Leetcode Permutation in String 双指针

Given two stringss1ands2, write a function to return true ifs2contains the permutation ofs1. In other words, one of the first string's permutations is thesubstringof the second string.Exa...

2020-01-31 22:27:41

Leetcode Valid Permutations for DI Sequence

We are givenS, a lengthnstring of characters from the set{'D', 'I'}. (These letters stand for "decreasing" and "increasing".)Avalid permutationis a permutationP[0], P[1], ..., P[n]of integer...

2020-01-31 16:57:54

Leetcode Perfect Squares 拉格朗日四平方

Given a positive integern, find the least number of perfect square numbers (for example,1, 4, 9, 16, ...) which sum ton.Example 1:Input: n = 12Output: 3 Explanation: 12 = 4 + 4 + 4.Example...

2020-01-30 16:57:03

查看更多

勋章 我的勋章
  • 持之以恒
    持之以恒
    授予每个自然月内发布4篇或4篇以上原创或翻译IT博文的用户。不积跬步无以至千里,不积小流无以成江海,程序人生的精彩需要坚持不懈地积累!
  • 1024勋章
    1024勋章
    #1024程序员节#活动勋章,当日发布原创博客即可获得
  • 勤写标兵Lv4
    勤写标兵Lv4
    授予每个自然周发布9篇以上(包括9篇)原创IT博文的用户。本勋章将于次周周三上午根据用户上周的博文发布情况由系统自动颁发。