leetcode-Single Number II

Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear
1次阅读

leetcode-Single Number

Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtim
2次阅读

LeetCode题解 15题 第二篇

之前写过一篇,这是第二篇。上一篇用了多种编程语言来做,这一次是以学算法为主,所以打算都用python来完成。 4. Median of Two Sorted ArraysThere are two sorted arrays nums1 and nums2&n
4次阅读

[LeetCode] Magical String 神奇字符串

 A magical string S consists of only '1' and '2' and obeys the following rules:The string S is magical because concatenating
11次阅读

LeetCode – 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 the list or null.Return a deep copy
6次阅读

leetcode-Word Break II

Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.Return all such po
5次阅读

[LeetCode] License Key Formatting 注册码格式化

 Now you are given a string S, which represents a software license key which we would like to format. The string S is composed of alphanumerical
15次阅读

[LeetCode] Number Complement 补数

 Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Note:The given
10次阅读

leetCode

记一次【求n以内的素数个数】的优化记录最近在leetCode上刷提,还是满锻炼人的,为以后面试打基础吧。不多说下面开始。 问题:求[2,n]之间的素数的个数。来源:leetCode OJ提示:Let's start with a isPrime function. To
5次阅读

[LeetCode] LFU Cache 最近最不常用页面置换缓存器

 Design and implement a data structure for Least Frequently Used (LFU) cache. It should support the following operations: get 
14次阅读