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
const s = "Dealing with failure is easy: Work hard to improve. Success is also easy to handle: You’ve solved the wrong problem. Work hard to improve" | |
function sumOfSentence(input: string){ | |
const vowels = new Set(['a','e','i','o','u']) | |
let sum = 0; | |
for(let i=0; i<input.length; i++){ | |
const character = input.charAt(i); | |
const asciiValue = input.charCodeAt(i) | |
if(asciiValue >= 65 && asciiValue <= 90 || asciiValue >= 97 && asciiValue <= 122){ | |
if(vowels.has(character.toLowerCase())){ | |
sum -= asciiValue; |
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
// given sorted array of numbers, find pair that sums to the target OR is closest to the target number | |
function findPair(a: number[], target: number): number[][]{ | |
let start = 0; | |
let end = a.length - 1 | |
let result: number[][] = [] | |
// if we have two values that are at the same distance from the target, | |
// then array will contain both values, else it will only contain value that is nearer | |
let nearByValues: number[][] = [] | |
let diff = Number.MAX_SAFE_INTEGER |
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
import React from "react"; | |
import RX, { Text, Component, View, Modal } from "reactxp"; | |
// import { App } from './App'; | |
import { DEBUG, DEV } from "./config"; | |
import Navigator, { | |
NavigatorDelegateSelector as DelegateSelector, | |
Types | |
} from "reactxp-navigation"; |
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
# creates a deployment | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: gql-server-deployment | |
labels: | |
app: simple-graphql-server | |
spec: | |
replicas: 3 | |
template: |
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
import java.io.*; | |
import java.util.*; | |
public class Solution { | |
public static void main(String[] args) { | |
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ | |
Scanner scan = new Scanner(System.in); | |
int noOfTestCases = scan.nextInt(); | |
int[][] input = new int[noOfTestCases][2]; |
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
import java.io.*; | |
import java.util.*; | |
public class Solution { | |
public static void main(String[] args) { | |
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ | |
Scanner scan = new Scanner(System.in); | |
int numTestCases = scan.nextInt(); | |
int[] input = new int[numTestCases]; |
This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.
###Array ####Definition:
- Stores data elements based on an sequential, most commonly 0 based, index.
- Based on tuples from set theory.
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
/* | |
isValid('{{()}}') = true | |
isValid('{{(]]}') = false | |
isValid('(({{()}}))') = true | |
isValid('(({{(}}))') = false | |
isValid('(({{()()}}))') = true | |
*/ | |
function isValid(expression){ | |
let stack = []; |