文章平均质量分 81
yuanhisn
这个作者很懒,什么都没留下…
展开
-
Fisher–Yates shuffle - Shuffle an Array in Place
Question: How do you shuffle an array in place? 伪代码如下: To shuffle an array a of n elements (indices 0..n-1): for i from n − 1 downto 1 do j ← random integer with 0 ≤ j ≤ i excha...原创 2015-01-31 05:51:34 · 82 阅读 · 0 评论 -
LeetCode 160 - Intersection of Two Linked Lists
Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: A: a1 → a2 ↘ ...原创 2015-08-03 23:25:19 · 91 阅读 · 0 评论 -
Linkedin Interview - Isomorphic Strings
Given two strings, determine if they are isomorphic. Two words are called isomorphic if the letters in one word can be remapped to get the second word. Remapping a letter means replacing all occurren...原创 2015-08-03 23:10:49 · 83 阅读 · 0 评论 -
Linkedin Interview - Sum of NestedInteger
Given a nested list of integers, returns the sum of all integers in the list weighted by their depth For example, given the list {{1,1},2,{1,1}} the function should return 10 (four 1's at depth 2,...原创 2015-03-16 00:23:26 · 87 阅读 · 0 评论 -
Data structure: insert, remove, contains, get random element, all at O(1)
From: http://stackoverflow.com/questions/5682218/data-structure-insert-remove-contains-get-random-element-all-at-o1 Design a data structure that offers the following operations in O(1) time: ins...原创 2015-03-15 00:07:10 · 67 阅读 · 0 评论