ZMR小站

很高兴遇见你~


  • 首页

  • 标签

  • 分类

  • 归档

p169

发表于 2016-06-06 | 分类于 blog

LeetCode 169 Majority Element 题解

1.题目:

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.

You may assume that the array is non-empty and the majority element always exist in the array.

阅读全文 »

p171

发表于 2016-05-29 | 分类于 blog

LeetCode 171 Excel Sheet Column Number 题解

1.题目:

Given a column title as appear in an Excel sheet, return its corresponding column number.

For example:

A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28 
阅读全文 »

p168

发表于 2016-05-29 | 分类于 blog

LeetCode 168 Excel Sheet Column Title 题解

1.题目:

Given a positive integer, return its corresponding column title as appear in an Excel sheet.

For example:

1 -> A
2 -> B
3 -> C
…
26 -> Z
27 -> AA
28 -> AB

阅读全文 »

p242

发表于 2016-05-28 | 分类于 blog

LeetCode p242 Valid Anagram 题解

1.题目:

Given two strings s and t, write a function to determine if t is an anagram of s.
For example,
s = “anagram”, t = “nagaram”, return true.
s = “rat”, t = “car”, return false.

阅读全文 »

p122

发表于 2016-05-28 | 分类于 blog

LeetCode 122 Best Time to Buy and Sell Stock II 题解

1.题目:

Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit.
You may complete as many transactions as you like (ie, buy one and sell one share of the stock multiple times).
However, you may not engage in multiple transactions at the same time (ie, you must sell the stock before you buy again).

阅读全文 »

p100

发表于 2016-05-27 | 分类于 blog

LeetCode 100 Same Tree 题解

1.题目:

Given two binary trees, write a function to check if they are equal or not.

Two binary trees are considered equal if they are structurally identical and the nodes have the same value.

阅读全文 »

p237

发表于 2016-05-27 | 分类于 blog

LeetCode 237 Delete Node in a Linked List 题解

1.题目:

Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.

Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value 3, the linked list should become 1 -> 2 -> 4 after calling your function.

阅读全文 »
1…293031…33
ZhangMengRou

ZhangMengRou

ZMR小站

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