/********************
** Write some code, that will flatten an array
** of arbitrarily nested arrays of integers
** into a flat array of integers.
** e.g. [[1,2,[3]],4] -> [1,2,3,4]
************************/
var answer = [];
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
MERGE INTO mp_users_plans Data | |
USING bckup_mp_usr_plan Source | |
ON Data.id = Source.id | |
AND Source.date < ‘<today>’ AND thm_order_id != ‘0' | |
WHEN MATCHED THEN | |
UPDATE | |
SET thm_order_id = Source.thm_order_id; |
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
[cparrish@sftp ~]$ sudo yum update | |
Loaded plugins: amazon-id, rhui-lb, security | |
Zend | 951 B 00:00 | |
Zend/primary | 26 kB 00:00 | |
Zend 145/145 | |
Zend_noarch | 951 B 00:00 | |
Zend_noarch/primary | 2.9 kB 00:00 | |
Zend_noarc |
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
Checking prerequisites... | |
Checking mgmt port [8089]: open | |
Checking conf files for problems... | |
Done | |
All preliminary checks passed. | |
Starting splunk server daemon (splunkd)... | |
Declared role=universal_forwarder. | |
Done |
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
[cparrish@localhost ~]$ homestead up | |
Bringing machine 'default' up with 'virtualbox' provider... | |
==> default: Checking if box 'laravel/homestead' is up to date... | |
==> default: Clearing any previously set forwarded ports... | |
==> default: Clearing any previously set network interfaces... | |
==> default: Preparing network interfaces based on configuration... | |
default: Adapter 1: nat | |
default: Adapter 2: hostonly | |
==> default: Forwarding ports... | |
default: 80 => 8000 (adapter 1) |
You are given an array of characters arr that consists of sequences of characters separated by space characters. Each space-delimited sequence of characters defines a word.
Implement a function reverseWords that reverses the order of the words in the array in the most efficient manner.
Explain your solution and analyze its time and space complexities.
function caesarCipher(str, num) {
[...arr] = str.toLowerCase();
return arr.map((val,indx,input)=> {
if (val.match(/[^a-z]/gi)) return val.charCodeAt(0);
let code = input.join('').charCodeAt(indx) + num;
return ( 96 < code && code < 123) ? code :
(code >= 123) ? code - 26 : code + 26;
});
function twoSum(arr, target) {
return arr.reduce((pairs, val, indx, srcArr) => {
let remainder = target - val;
let indx2 = srcArr.indexOf(remainder);
return indx2 !== -1 ? [...pairs, [val, remainder]] : pairs;
}, []);
}
const numArray = [1, 6, 4, 5, 3, 3];
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
/**
* Definition for singly-linked list.
* function ListNode(val) {
function LinkedList(head = null, tail= null) {
this.head = head;
this.tail = (tail)? tail: head;
}
function ListNode(val, next=null, previous=null) {
this.val = val;
this.next = next;
this.previous = previous;
OlderNewer