Olivia Liu Blog

Hello world to all the glorious developers.

Leetcode 476. Number Complement

Lintcode 1218. 补数

Description Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation. 给定一个正整数,输出它的补数。补数是将原先数字的二进制表示按位取反,再换回十进制后得到的新数。 Exam...

Leetcode 383. Ransom Note

Lintcode 1270. 勒索信

Description Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constructed from th...

Leetcode 771. Jewels and Stones

Lintcode 1038. 珠宝和石头

Description You’re given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know how m...

Leetcode 278. First Bad Version

Lintcode 74. 第一个错误的代码版本

Description You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is develo...

Leetcode 211. Add and Search Word - Data structure design

Lintcode 473. 单词的添加与查找

Description Design a data structure that supports the following two operations: void addWord(word) bool search(word) search(word) can search a literal word or a regular expression string contai...

Leetcode 148. Copy List with Random Pointer

Lintcode 98. 链表排序

Description Sort List Sort a linked list in O(n log n) time using constant space complexity. 在 O(n log n) 时间复杂度和常数级的空间复杂度下给链表排序。 Examples Input: -1->5->3->4->0 Output: -1->0->...

Leetcode Weekly Contest 162

Leetcode 周赛 162

Description Total 4 questions: Cells with Odd Values in a Matrix Reconstruct a 2-Row Binary Matrix Number of Closed Islands Maximum Score Words Formed by Letters Answer Cells with Od...

Leetcode 138. Copy List with Random Pointer

Lintcode 105. 复制带随机指针的链表

Description Merge Intervals 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 of the list. 给...

Leetcode 56. Merge Intervals

Lintcode 156. 合并区间

Description Merge Intervals Given a collection of intervals, merge all overlapping intervals. 给出若干闭合区间,合并所有重叠的部分。 Examples Input: [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]] Ex...

Leetcode 234. Palindrome Linked List

Lintcode 223. 回文链表

Description Palindrome Linked List Given a singly linked list, determine if it is a palindrome. 设计一种方式检查一个链表是否为回文链表。 Examples Input: 1->2 Output: false Answer Find the middle point of th...