I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Find the longest palindrome in the text. | |
* | |
* This is Greplin's first challenge, and I originally solved it in Python. | |
* | |
* This algorithm is linear on the average input, but has a quadratic | |
* worst case running time. There exists an even better algorithm, but | |
* this should do. | |
* | |
* There might also be a small error below, but you get the general idea. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void switch_func(int n) { | |
char *s; | |
switch(n) { | |
case 0: | |
s = "Sun"; | |
if(0) | |
case 1: | |
{ s = "Mon"; } | |
if(0) | |
case 2: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
D [0-9] | |
L [a-zA-Z_] | |
H [a-fA-F0-9] | |
E ([Ee][+-]?{D}+) | |
P ([Pp][+-]?{D}+) | |
FS (f|F|l|L) | |
IS ((u|U)|(u|U)?(l|L|ll|LL)|(l|L|ll|LL)(u|U)) | |
%{ | |
#include <stdio.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file shows a hack to achieve operator overloading in | |
// JavaScript. I have defined 3 different operators: | |
// | |
// >= = monadic bind | |
// >> = kleisli composition | |
// > = functor map | |
// * = applicative apply | |
// + = semigroup append | |
// | |
// Head straight to the bottom to see example usages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/*****************NATIVE forEACH*********************/ | |
Array.prototype.myEach = function(callback) { | |
for (var i = 0; i < this.length; i++) | |
callback(this[i], i, this); | |
}; | |
//tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Build GraphQL server using `express-graphql` package. | |
2. Configure `schema.js` file. | |
3. Query for data. |
A full parsing table is not needed, only the canonical collection. In the canonical collection, find all final items (and only final items), and see if:
- There are both shift and reduce in the same item ("shift-reduce", s/r)
- There are two reduce actions in the same item ("reduce-reduce", r/r)
If none of these is true, there are no conflicts, even in LR(0). If there are some of the above, SLR(1) still may solve it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <functional> | |
#include <string> | |
#if __cplusplus <= 201200L | |
namespace std { | |
// index_sequence |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
000(023Rb|001Rb) | |
001(017La|002Rb) | |
002(021La|003Rb) | |
003(021La|004La) | |
004(009Rb|005Lb) | |
005(004Ra|005La) | |
006(008La|007La) | |
007(009Rb|007La) | |
008(009Ra|008La) | |
009(010Ra|026Ra) |
OlderNewer