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
//https://www.hackerrank.com/challenges/diagonal-difference/problem?isFullScreen=true | |
function diagonalDifference(arr) { | |
let sum1 = 0, sum2 = 0 | |
for(let i = 0; i < arr.length; i++ ){ | |
sum1 += arr[i][i] | |
let j = arr.length - 1 - i | |
sum2 += arr[i][j] | |
//console.log(arr[i][j]) | |
} |
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
Example 1: | |
const pets = ['Cat', 'Dog', 'Bird', 'Fish', 'Frog', 'Hamster', 'Pig', 'Horse' 'Lion', 'Dragon']; | |
// Print all pets | |
console.log(pets[0]); | |
console.log(pets[1]); | |
console.log(pets[2]); | |
console.log(pets[3]); | |
... | |
.cat { |
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
npm install [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] |
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
version: "2" | |
services: | |
namenode: | |
build: ./namenode | |
image: bde2020/hadoop-namenode:1.1.0-hadoop2.7.1-java8 | |
container_name: namenode | |
volumes: | |
- hadoop_namenode:/hadoop/dfs/name | |
environment: |
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
new Vue({ | |
el: '#app', | |
data: { | |
items: [], | |
interval: null, | |
}, | |
methods: { | |
loadData: function () { | |
$.get('/api/data', function (response) { | |
this.items = response.items; |
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
class Node | |
attr_accessor :value, :left, :right | |
def initialize(value =nil) | |
@value = value | |
@left = nil | |
@right = nil | |
end | |
end |
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
class Node | |
attr_accessor :value, :next_node | |
def initialize(value) | |
@value = value | |
@next_node = nil | |
end | |
def tail? | |
@next_node.nil? | |
end | |
end |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
</head> | |
<body> | |
<ul> Ingredients | |
<li>Sugar</li> | |
<li>Milk</li> |
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
function pairElement(str) { | |
arr = str.split(''); | |
arr2 = []; | |
for (i = 0; i < arr.length-1; i++) { | |
for (k =1; k < arr.length; k++) { | |
if(arr[i] != arr[k]){ | |
arr2.push([arr[i],arr[k]]); | |
} | |
} |
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
DNA Pairing | |
The DNA strand is missing the pairing element. Take each character, get its pair, and return the results as a 2d array. | |
Base pairs are a pair of AT and CG. Match the missing element to the provided character. | |
Return the provided character as the first element in each array. | |
For example, for the input GCG, return [["G", "C"], ["C","G"],["G", "C"]] | |
The character and its pair are paired up in an array, and all the arrays are grouped into one encapsulating array. |
NewerOlder