摘要:
https://www.hackerrank.com/challenges/minimum-swaps-2/problem Minimum Swaps II You are given an unordered array consisting of consecutive integers [1, 阅读全文
摘要:
外排序 通常来说,外排序处理的数据不能一次装入内存,只能放在读写较慢的外存储器(通常是硬盘)上。外排序通常采用的是一种“排序-归并”的策略。在排序阶段,先读入能放在内存中的数据量,将其排序输出到一个临时文件,依此进行,将待排序数据组织为多个有序的临时文件。之后在归并阶段将这些临时文件组合为一个大的有 阅读全文
摘要:
How would you remove duplicate lines from a file that is much too large to fit in memory? The duplicate lines are not necessarily adjacent, and say th 阅读全文
摘要:
有编号1~100个灯泡,起初所有的灯都是灭的。有100个同学来按灯泡开关,如果灯是亮的,那么按过开关之后,灯会灭掉。如果灯是灭的,按过开关之后灯会亮。 现在开始按开关。 第1个同学,把所有的灯泡开关都按一次(按开关灯的编号: 1,2,3,......100)。第2个同学,隔一个灯按一次(按开关灯的编 阅读全文
摘要:
Given a non-negative number represented as a singly linked list of digits, plus one to the number. The digits are stored such that the most significan 阅读全文
摘要:
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced bina 阅读全文
摘要:
Given an array where elements are sorted in ascending order, convert it to a height balanced BST. For this problem, a height-balanced binary tree is d 阅读全文
摘要:
Given a paragraph and a list of banned words, return the most frequent word that is not in the list of banned words. It is guaranteed there is at leas 阅读全文
摘要:
Design a Tic-tac-toe game that is played between two players on a n x n grid. You may assume the following rules: A move is guaranteed to be valid and 阅读全文