epi

所属分类:Leetcode/题库
开发工具:GO
文件大小:138KB
下载次数:0
上传日期:2022-06-07 13:15:34
上 传 者sh-1993
说明:  编程元素的解决方案用Golang编写的面试问题(正在进行的工作)
(Solutions for Elements of Programming Interviews problems written in Golang (work-in-progress))

文件列表:
.travis.yml (61, 2016-07-24)
AUTHORS.txt (33, 2016-07-24)
LICENSE.txt (1101, 2016-07-24)
arrays (0, 2016-07-24)
arrays\doc.go (320, 2016-07-24)
arrays\duplicates.go (660, 2016-07-24)
arrays\duplicates_test.go (1456, 2016-07-24)
arrays\dutchflag.go (992, 2016-07-24)
arrays\dutchflag_test.go (1376, 2016-07-24)
arrays\enumprimes.go (2660, 2016-07-24)
arrays\enumprimes_test.go (1792, 2016-07-24)
arrays\maxdiff.go (1210, 2016-07-24)
arrays\maxdiff_test.go (1494, 2016-07-24)
arrays\nextperm.go (1186, 2016-07-24)
arrays\nextperm_test.go (1121, 2016-07-24)
arrays\spiralmetrix.go (1367, 2016-07-24)
arrays\spiralmetrix_test.go (1609, 2016-07-24)
bsearch (0, 2016-07-24)
bsearch\doc.go (357, 2016-07-24)
bsearch\equals.go (568, 2016-07-24)
bsearch\equals_test.go (1113, 2016-07-24)
bsearch\firstk.go (607, 2016-07-24)
bsearch\firstk_test.go (1238, 2016-07-24)
bsearch\greaterk.go (519, 2016-07-24)
bsearch\greaterk_test.go (1319, 2016-07-24)
bsearch\sqrtreal.go (1267, 2016-07-24)
bsearch\sqrtreal_test.go (882, 2016-07-24)
bstrees (0, 2016-07-24)
bstrees\bstree.go (299, 2016-07-24)
bstrees\doc.go (335, 2016-07-24)
bstrees\firstk.go (658, 2016-07-24)
bstrees\firstk_test.go (1341, 2016-07-24)
bstrees\greaterk.go (603, 2016-07-24)
bstrees\greaterk_test.go (1727, 2016-07-24)
bstrees\property.go (848, 2016-07-24)
bstrees\property_test.go (2182, 2016-07-24)
... ...

epi === [![Build Status](https://travis-ci.org/mrekucci/epi.svg)](https://travis-ci.org/mrekucci/epi) [![Coverage Status](https://coveralls.io/repos/mrekucci/epi/badge.svg?branch=master&service=github)](https://coveralls.io/github/mrekucci/epi?branch=master) [![GitHub license](https://img.shields.io/github/license/mashape/apistatus.svg)](LICENSE.txt) This is a work-in-progress, solutions for [Elements of Programming Interviews][1] problems written in Golang. Solutions ========= Primitive Types --------------- | Problem | Test | Solved | |--------------------------------------------------------------------------|:------------:|:-------:| | [Computing the parity of a word][2] | [tests][3] | | | [Swap bits][4] | [tests][5] | | | [Reverse bits][6] | [tests][7] | | | [Find a closest integer with the same weight][8] | [tests][9] | | | [Compute *x × y* without arithmetical operators][10] | [tests][11] | | | [Compute *x/y*][12] | [tests][13] | | | [Compute *x^y*][14] | [tests][15] | | | [Reverse digits][16] | [tests][17] | | | [Check if a decimal integer is a palindrome][18] | [tests][19] | | | [Generate uniform random numbers][20] | [tests][21] | | | [Rectangle intersection][22] | [tests][23] | | Arrays ------ | Problem | Test | Solved | |--------------------------------------------------------------------------|:------------:|:-------:| | [The Dutch national flag problem][24] | [tests][25] | | | [Increment an arbitrary-precision integer][26] | [tests][27] | | | [Multiply two arbitrary-precision integers][28] | [tests][29] | | | [Advancing through an array][30] | [tests][31] | | | [Delete a key from an array][32] | [tests][33] | | | [Delete duplicates from a sorted array][34] | [tests][35] | | | [Robot's minimum battery capacity][36] | [tests][37] | | | [Buy and sell a stock twice][38] | [tests][39] | | | [Enumerate all primes to *n*][40] | [tests][41] | | | [Permute the elements of an array][42] | [tests][43] | | | [Compute the next permutation][44] | [tests][45] | | | [Sample offline data][46] | [tests][47] | | | [Sample online data][48] | [tests][49] | | | [Compute a random permutation][50] | [tests][51] | | | [Compute a random subset][52] | [tests][53] | | | [Generate nonuniform random numbers][54] | [tests][55] | | | [The Sudoku checker problem][56] | [tests][57] | | | [Compute the spiral ordering of a 2D array][58] | [tests][59] | | | [Rotate a 2D array][60] | [tests][61] | | | [Compute rows in Pascal’s Triangle][62] | [tests][63] | | Strings ------- | Problem | Test | Solved | |--------------------------------------------------------------------------|:------------:|:-------:| | [Interconvert strings and integers][***] | [tests][65] | | | [Base conversion][66] | [tests][67] | | | [Compute the spreadsheet column encoding][68] | [tests][69] | | | [Replace and remove][70] | [tests][71] | | | [Test palindromicity][72] | [tests][73] | | | [Reverse all the words in a sentence][74] | [tests][75] | | | [Compute all mnemonics for a phone number][76] | [tests][77] | | | [The look-and-say problem][78] | [tests][79] | | | [Convert from Roman to decimal][80] | [tests][81] | | | [Compute all valid IP addresses][82] | [tests][83] | | | [Write a string sinusoidally][84] | [tests][85] | | | [Implement run-length encoding][86] | [tests][87] | | | [Implement the UNIX `tail` command][88] | [tests][89] | | | [Find the first occurrence of a substring][90] | [tests][91] | | Linked List ----------- | Problem | Test | Solved | |--------------------------------------------------------------------------|:------------:|:-------:| | [Merge two sorted lists][92] | [tests][93] | | | [Reverse a singly linked list][94] | [tests][95] | | | [Reverse a single sublist][96] | [tests][97] | | | [Test for cyclicity][***] | [tests][99] | | | [Test for overlapping lists—lists are cycle-free][100] | [tests][101] | | | [Test for overlapping lists—lists may have cycles][102] | [tests][103] | | | [Delete a node from a singly linked list][104] | [tests][105] | | | [Remove the *k*th last element from a list][106] | [tests][107] | | | [Remove duplicates from a sorted list][108] | [tests][109] | | | [Implement cyclic right shift for singly linked lists][110] | [tests][111] | | | [Implement even-odd merge][112] | [tests][113] | | | [Test whether a singly linked list is palindromic][114] | [tests][115] | | | [Implement list pivoting][116] | [tests][117] | | | [Add list-based integers][118] | [tests][119] | | Stacks and Queues ----------------- ### Stacks | Problem | Test | Solved | |--------------------------------------------------------------------------|:------------:|:-------:| | [Implement a stack with max API][120] | [tests][121] | | | [Evaluate RPN expressions][122] | [tests][123] | | | [Test a string over “{,},(,),[,]” for well-formedness][124] | [tests][125] | | | [Normalize pathnames][126] | [tests][127] | | | [BST keys in sort order][128] | [tests][129] | | | [Search a postings list][130] | [tests][131] | | | [Compute buildings with a sunset view][132] | [tests][133] | | | [Sort a stack][134] | [tests][135] | | ### Queues | Problem | Test | Solved | |--------------------------------------------------------------------------|:------------:|:-------:| | [Compute binary tree nodes in order of increasing depth][136] | [tests][137] | | | [Implement a circular queue][138] | [tests][139] | | | [Implement a queue using stacks][140] | [tests][141] | | | [Implement a queue with max API][142] | [tests][143] | | Binary Trees ------------ | Problem | Test | Solved | |--------------------------------------------------------------------------|:------------:|:-------:| | [Test if a binary tree is balanced][144] | [tests][145] | | | [Test if a binary tree is symmetric][146] | [tests][147] | | | [Compute the lowest common ancestor in a binary tree][148] | [tests][149] | | | [Compute the LCA when nodes have parent pointers][150] | [tests][151] | | | [Sum the root-to-leaf paths in a binary tree][152] | [tests][153] | | | [Find a root to leaf path with specified sum][154] | [tests][155] | | | [Compute the *k*th node in an inorder traversal][156] | [tests][157] | | | [Compute the successor][158] | [tests][159] | | | [Implement an inorder traversal with *O(1)* space][160] | [tests][161] | | | [Reconstruct a binary tree from traversal data][162] | [tests][163] | | | [Reconstruct a binary tree from a preorder traversal with markers][1***] | [tests][165] | | | [Form a linked list from the leaves of a binary tree][166] | [tests][167] | | | [Compute the exterior of a binary tree][168] | [tests][169] | | | [Compute the right sibling tree][170] | [tests][171] | | | [Implement locking in a binary tree][172] | [tests][173] | | Heaps ----- | Problem | Test | Solved | |--------------------------------------------------------------------------|:------------:|:-------:| | [Merge sorted files][174] | [tests][175] | | | [Sort an increasing-decreasing array][176] | [tests][177] | | | [Sort an almost-sorted array][178] | [tests][179] | | | [Compute the *k* closest stars][180] | [tests][181] | | | [Compute the median of online data][182] | [tests][183] | | | [Compute the *k* largest elements in a max-heap][184] | [tests][185] | | | [Implement a stack API using a heap][186] | [tests][187] | | Searching --------- ### Binary Search | Problem | Test | Solved | |--------------------------------------------------------------------------|:------------:|:-------:| | [Search a sorted array for first occurrence of *k*][188] | [tests][189] | | | [Search a sorted array for the first element greater than *k*][190] | [tests][191] | | | [Search a sorted array for entry equal to its index][192] | [tests][193] | | | [Search a cyclically sorted array][194] | [tests][195] | | | [Compute the integer square root][196] | [tests][197] | | | [Compute the real square root][1***] | [tests][199] | | ### Generalized Search | Problem | Test | Solved | |--------------------------------------------------------------------------|:------------:|:-------:| | [Search in a 2D sorted array][200] | [tests][201] | | | [Find the min and max simultaneously][202] | [tests][203] | | | [Find the *k*th largest element][204] | [tests][205] | | | [Compute the optimum mailbox placement][206] | [tests][207] | | | [Find the missing IP address][208] | [tests][209] | | | [Find the duplicate and missing elements][210] | [tests][211] | | Hash Tables ----------- | Problem | Test | Solved | |--------------------------------------------------------------------------|:------------:|:-------:| | [Partition into anagrams][212] | [tests][213] | | | [Test for palindromic permutations][214] | [tests][215] | | | [Is an anonymous letter constructible?][216] | [tests][217] | | | [Implement an ISBN cache][218] | [tests][219] | | | [Compute the LCA, optimizing for close ancestors][220] | [tests][221] | | | [Compute the *k* most frequent queries][222] | [tests][223] | | | [Find the nearest repeated entries in an array][224] | [tests][225] | | | [Find the smallest subarray covering all values][226] | [tests][227] | | | [Find smallest subarray sequentially covering all values][228] | [tests][229] | | | [Find the longest subarray with distinct entries][230] | [tests][231] | | | [Find the length of a longest contained range][232] | [tests][233] | | | [Compute the average of the top three scores][234] | [tests][235] | | | [Compute all string decompositions][236] | [tests][237] | | | [Find a highest affinity pair][238] | [tests][239] | | | [Test the Collatz conjecture][240] | [tests][241] | | | [Implement a hash function for chess][242] | [tests][243] | | Sorting ------- | Problem | Test | Solved | |--------------------------------------------------------------------------|:------------:|:-------:| | [Compute the intersection of two sorted arrays][244] | [tests][245] | | | [Implement mergesort in-place][246] | [tests][247] | | | [Count the frequencies of characters in a sentence][248] | [tests][249] | | | [Find unique elements][250] | [tests][251] | | | [Render a calendar][252] | [tests][253] | | | [Sets of disjoint intervals][254] | [tests][255] | | | [Compute the union of intervals][256] | [tests][257] | | | [Partitioning and sorting an array with many repeated entries][258] | [tests][259] | | | [Team photo day—1][260] | [tests][261] | | | [Implement a fast sorting algorithm for lists][262] | [tests][263] | | | [Compute a salary threshold][2***] | [tests][265] | | Binary Search Trees ------------------- | Problem | Test | Solved | |--------------------------------------------------------------------------|:------------:|:-------:| | [Test if a binary tree satisfies the BST property][266] | [tests][267] | | | [Find the first occurrence of a key in a BST][268] | [tests][269] | | | [Find the first key larger than a given value in a BST][270] | [tests][271] | | | [Find the *k* largest elements in a BST][272] | [tests][273] | | | [Compute the LCA in a BST][274] | [tests][275] | | | [Reconstruct a BST from traversal data][276] | [tests][277] | | | [Find the closest entries in three sorted arrays][278] | [tests][279] | | | [Enumerate numbers of the form *a + b√2*][280] | [tests][281] | | | [The most visited pages problem][282] | [tests][283] | | | [Build a minimum height BST from a sorted array][284] | [tests][285] | | | [Insertion and deletion in a BST][286] | [tests][287] | | | [Test if three BST nodes are totally ordered][288] | [tests][289] | | | [The range lookup problem][290] | [tests][291] | | | [Add credits][292] | [tests][293] | | | [Count the number of entries in an interval][294] | [tests][295] | | Recursion --------- | Problem | Test | Solved | |--------------------------------------------------------------------------|:------------:|:-------:| | [The Tower of Hanoi problem][296] | [tests][297] | | | [Generate all nonattacking placements of *n*-Queens][2***] | [tests][299] | | | [Generate permutations][300] | [tests][301] | | | [Generate the power set][302] | [tests][303] | | | [Generate all subsets of size *k*][304] | [tests][305] | | | [Generate strings of matched parens][306] | [tests][307] | | | [Generate palindromic decompositions][308] | [tests][309] | | | [Generate binary trees][310] | [tests][311] | | | [Implement a Sudoku solver][312] | [tests][ ... ...

近期下载者

相关文件


收藏者