ZMR小站

很高兴遇见你~


  • 首页

  • 标签

  • 分类

  • 归档

p219

发表于 2017-02-17 | 分类于 blog

LeetCode p219 Contains Duplicate II 题解

1.题目:

Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the absolute difference between i and j is at most k.

阅读全文 »

p205

发表于 2017-02-17 | 分类于 blog

LeetCode p205 Isomorphic Strings 题解

1.题目:

Given two strings s and t, determine if they are isomorphic.

Two strings are isomorphic if the characters in s can be replaced to get t.

All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character but a character may map to itself.

For example,
Given “egg”, “add”, return true.

Given “foo”, “bar”, return false.

Given “paper”, “title”, return true.

阅读全文 »

p204

发表于 2017-02-16 | 分类于 blog

LeetCode p204 Count Primes 题解

1.题目:

Description:

Count the number of prime numbers less than a non-negative number, n.

阅读全文 »

p203

发表于 2017-02-16 | 分类于 blog

LeetCode p203 Remove Linked List Elements 题解

1.题目:

Remove all elements from a linked list of integers that have value val.

Example
Given: 1 –> 2 –> 6 –> 3 –> 4 –> 5 –> 6, val = 6
Return: 1 –> 2 –> 3 –> 4 –> 5

阅读全文 »

p190

发表于 2017-02-16 | 分类于 blog

LeetCode p190 Reverse Bits 题解

1.题目:

Reverse bits of a given 32 bits unsigned integer.

For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110000010100101000000).

阅读全文 »

p189

发表于 2017-02-16 | 分类于 blog

LeetCode p189 Rotate Array 题解

1.题目:

Rotate an array of n elements to the right by k steps.

For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].

阅读全文 »

p172

发表于 2017-02-15 | 分类于 blog

LeetCode p172 Factorial Trailing Zeroes 题解

1.题目:

Given an integer n, return the number of trailing zeroes in n!.

Note: Your solution should be in logarithmic time complexity.

阅读全文 »

1…567…33
ZhangMengRou

ZhangMengRou

ZMR小站

230 日志
4 分类
14 标签
© 2019 ZhangMengRou
由 Hexo 强力驱动
|
主题 — NexT.Gemini v5.1.4