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
| #!/bin/bash | |
| # | |
| # Bash script to setup headless Selenium (uses Xvfb and Chrome) | |
| # (Tested on Ubuntu 12.04) trying on ubuntu server 14.04 | |
| # Add Google Chrome's repo to sources.list | |
| echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | tee -a /etc/apt/sources.list | |
| # Install Google's public key used for signing packages (e.g. Chrome) | |
| # (Source: http://www.google.com/linuxrepositories/) |
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
| module.exports = [1,17,80,68,5,5,58,17,38,81,26,44,38,6,12,11,37,67,70,16,19,35,71,16,32,45,7,39,2,14,16,78,82,5,18,86,61,37,12,8,27,90,13,26,57,24,36,4,52,67,71,71,11,51,48,42,57,16,43,58,29,58,8,20,24,25,15,84,61,78,53,49,39,66,75,6,51,72,9,13,49,79,45,21,1,2,63,20,17,67,39,45,86,46,26,19,70,2,64,2,79,78,51,28,53,87,85,14,68,55,78,78,5,32,9,57,85,71,76,11,9,25,17,4,32,42,74,64,5,47,65,83,34,77,72,49,73,66,24,13,82,11,90,86,4,8,53,88,40,38,8,48,24,76,13,56,79,86,29,83,4,3,37,38,42,19,48,24,46,71,36,38,81,88,85,46,57,47,43,7,85,50,16,70,87,29,35,75,24,63,67,28,28,13,27,69,83,36,54,39,16,52,38,58,49,32,13,15,79,55,73,35,66,89,14,62,79,11,46,64,73,74,1,62,86,79,40,79,24,4,79,1,17,26,58,65,19,32,79,59,86,62,55,23,22,31,84,10,41,1,73,75,74,36,47,70,76,48,20,62,13,8,62,29,85,82,3,65,23,44,34,71,67,88,3,50,28,49,59,30,49,3,15,85,90,23,26,76,70,45,9,45,14,70,35,60,23,90,34,46,43,29,78,71,79,42,30,16,52,50,8,63,52,22,57,14,6,82,89,37,88,7,81,11,38,26,32,61,77,27,68,81,56,17,61,44,58,52,21,20,11,28,82,24,11,10,37,16,1 |
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
| const largeInteger = require('./file-with-int-array.js'); | |
| // time complexity | |
| // space complexity | |
| const quickSort = (arr) => { | |
| const arrLength = arr.length; | |
| if (arrLength <= 1) { | |
| return arr; | |
| } | |
| const leftHalf = []; | |
| const rightHalf = []; |
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
| var searchInsert = function(nums, target) { | |
| let left = 0; | |
| let right = nums.length - 1; | |
| while(left <= right) { | |
| const mid = left + (right - left / 2); | |
| if (nums[mid] === target) { | |
| return mid; |
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
| // keep track the head node | |
| // keep track of the tail | |
| // be able to insert, delete and check | |
| function Node(rawData, nextNode = null) { | |
| let data = rawData; | |
| let next = nextNode; | |
| return { | |
| data, |
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
| var mergeTwoLists = function(l1, l2) { | |
| // declare our return list | |
| // go through the lists | |
| // compare the weight of nodes | |
| // add the node with the lightest weight | |
| // to our result list | |
| // continue till we get to the end of the lists | |
| let resultListTail = null; // [2,(3),5,6,7,7,] | |
| let resultListHead = null; |
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
| /** | |
| * Definition for singly-linked list. | |
| * function ListNode(val) { | |
| * this.val = val; | |
| * this.next = null; | |
| * } | |
| */ | |
| /** | |
| * @param {ListNode} head |
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
| function q() { //FIFo | |
| var arr = [3,6,7]; | |
| return { | |
| enqueue: data => { | |
| arr.unshift(data); | |
| }, | |
| dequeue: () => { | |
| return arr.pop(); |
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
| function Node (rawData, leftNode = null, rightNode = null) { | |
| let data = rawData; | |
| let left = leftNode; | |
| let right = rightNode; | |
| return { | |
| data, | |
| left, | |
| right |
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
| /** | |
| * Definition for a binary tree node. | |
| * function TreeNode(val, left, right) { | |
| * this.val = (val===undefined ? 0 : val) | |
| * this.left = (left===undefined ? null : left) | |
| * this.right = (right===undefined ? null : right) | |
| * } | |
| */ | |
| /** | |
| * @param {TreeNode} root |