- 博客(11)
- 收藏
- 关注
原创 Mark-Sweep算法
一点前言 GC的各种算法本质上是由3种基本的算法组合优化来的,即Mark-Sweep标记清除算法、引用计数法和GC复制算法。 今天主要学习下Mark-Sweep标记清除算法。 最基本的Mark-Sweep标记清除算法 标记清除算法由标记阶段和清除阶段组成,标记阶段会将当前仍然活跃的对象的mark字段标记为true(数据结构一般是stack)。清除阶段则是遍历所有的对象列表(数据结构一般为队列,链表等
2017-03-21 00:24:50 3279
原创 142. Linked List Cycle II
题目Given a linked list, return the node where the cycle begins. If there is no cycle, return null.Note: Do not modify the linked list.Follow up: Can you solve it without using extra space?Subscribe to
2017-03-20 23:36:13 231
原创 504. Base 7
题目Given an integer, return its base 7 string representation.Example 1: Input: 100 Output: “202” Example 2: Input: -7 Output: “-10” Note: The input will be in range of [-1e7, 1e7].Subscribe to see
2017-03-06 01:27:42 333
原创 371. Sum of Two Integers
题目Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.Example: Given a = 1 and b = 2, return 3.Credits: Special thanks to @fujiaozhu for adding this problem
2017-03-06 01:11:05 465
原创 535. Encode and Decode TinyURL
题目Note: This is a companion problem to the System Design problem: Design TinyURL. TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/problems/design-tinyurl and it
2017-03-05 22:06:37 1614
原创 389. Find the Difference
题目Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at a random position.Find the letter that was added i
2017-03-04 00:08:03 355
原创 448. Find All Numbers Disappeared in an Array
题目Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements of [1, n] inclusive that do not appear in this array.Could y
2017-03-03 23:56:25 280
原创 463. Island Perimeter
题目You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely
2017-03-03 00:15:05 168
原创 412. Fizz Buzz
题目Write a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”. For
2017-03-02 00:35:33 263
原创 419. Battleships in a Board
题目Given an 2D board, count how many battleships are in it. The battleships are represented with ‘X’s, empty slots are represented with ‘.’s. You may assume the following rules:You receive a valid board
2017-03-01 23:51:29 215
原创 461. Hamming Distance
题目The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hamming distance.Note: 0 ≤ x, y < 231.Exa
2017-03-01 00:28:12 178
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人