This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
| <title>Home</title> | |
| <link rel="shortcut icon" type="image/png" href="icons/favicon_01.png" /> | |
| <link rel="stylesheet" type="text/css" href="reset.css"> | |
| <link rel="stylesheet" type="text/css" href="style.css"> | |
| </head> | |
| <body> |
This file contains hidden or 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
| findMin(arr, 0, len(findMin) -1) | |
| def findMin(arr, low, high): | |
| # This condition is needed to handle the case when array is not | |
| # rotated at all | |
| if high < low: | |
| return 0 | |
| # If there is only one element left | |
| if high == low: |
This file contains hidden or 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
| # "Binary search the pivot" | |
| def find_pivot(array, low, high): | |
| # If low becomes higher not found | |
| if (high < low): return -1 | |
| if (high == low): return low | |
| mid = (low + high) // 2 | |
| # If at the boundary [4,5,1,2,3] if mid = 2 and high = 4, arr[m] is not > arr[m + 1] | |
| # check if 1 > 2: goal to find 5 > 1 | |
| # mid < high so that mid + 1 is valid |
This file contains hidden or 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
| lcd_numbers = { | |
| '0': [' {under} ', '{pipe}{space}{pipe}', '{pipe}{under}{pipe}'], | |
| '1': [' {space} ', ' {space}{pipe}', ' {space}{pipe}'], | |
| '2': [' {under} ', ' {under}{pipe}', '{pipe}{under} '], | |
| '3': [' {under} ', ' {under}{pipe}', ' {under}{pipe}'], | |
| '4': [' {space} ', '{pipe}{under}{pipe}', ' {space}{pipe}'], | |
| '5': [' {under} ', '{pipe}{under} ', ' {under}{pipe}'], | |
| '6': [' {under} ', '{pipe}{under} ', '{pipe}{under}{pipe}'], | |
| '7': [' {under} ', ' {space}{pipe}', ' {space}{pipe}'], | |
| '8': [' {under} ', '{pipe}{under}{pipe}', '{pipe}{under}{pipe}'], |
This file contains hidden or 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
| exports.findKanji = (req, res) => { | |
| const key = req.params.kanji; | |
| redisClient.get(key, function(error, result) { | |
| // If not found in redis, check Mongo | |
| if (result === null || error) { | |
| MongoClient.connect(url, function(mongoError, db) { | |
| // If can't connect throw 404 | |
| if (mongoError) { | |
| res.status(404).send({}); |