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
def comp(array1, array2) | |
return false if array1.nil? || array2.nil? | |
hash1 = {} | |
hash2 = {} | |
array1.each do |a| | |
hash1[a] = hash1[a].nil? ? 1 : hash1[a] + 1 | |
end | |
array2.each do |a| |
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
/** | |
* @param {number[]} nums | |
* @param {number} target | |
* @return {number[]} | |
*/ | |
var twoSum = function(nums, target) { | |
for (let i = 0; i < nums.length; i++) { | |
const firstNumber = nums[i]; | |
const secondNumberIndex = nums.slice(i+1).indexOf(target - firstNumber) + i + 1; |
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.codewars.com/kata/55fd2d567d94ac3bc9000064/solutions/javascript | |
function rowSumOddNumbers(n) { | |
return n ** 3; | |
} |
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
#!/bin/ruby | |
require 'json' | |
require 'stringio' | |
# | |
# Complete the 'minimumDistances' function below. | |
# | |
# The function is expected to return an INTEGER. | |
# The function accepts INTEGER_ARRAY a as parameter. |
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]); | |
//... | |
// == EXAMPLE 2 ==================================== |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
<?php | |
/** | |
* Create a new custom yoast seo sitemap | |
*/ | |
add_filter( 'wpseo_sitemap_index', 'ex_add_sitemap_custom_items' ); | |
add_action( 'init', 'init_wpseo_do_sitemap_actions' ); | |
// Add custom index |
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
<link rel="import" href="../topeka-elements/category-images.html"> | |
<link rel="import" href="../core-icon/core-icon.html"> | |
<link rel="import" href="../core-icons/core-icons.html"> | |
<link rel="import" href="../core-icons/av-icons.html"> | |
<link rel="import" href="../paper-fab/paper-fab.html"> | |
<link rel="import" href="../topeka-elements/category-icons.html"> | |
<polymer-element name="my-element"> | |
<template> |