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: 0.2 | |
env: | |
secrets-manager: | |
SONAR_TOKEN: prod/sonar:SONAR_TOKEN | |
SONAR_HOST_URL: prod/sonar:SONAR_HOST_URL | |
variables: | |
SourceBranch: "" | |
DestinationBranch: "" | |
IMAGE_REPO_NAME: "app-container-repo" | |
IMAGE_TAG: "Latest" |
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 AppDispatcherInstance = require('../dispatcher/AppDispatcher'); | |
import Events = require('events'); | |
import React = require('react'); | |
import AppDispatcher = require("../dispatcher/AppDispatcher"); | |
//This is just an alias for the interface AppDispatcher.AppPayload | |
import Payload = AppDispatcher.AppPayload | |
import ActionIdentifier = AppDispatcher.ActionIdentifier | |
import Interfaces = require('../Tree/Interfaces') |
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 an integer n and two indexes i, j s.t. i >= j. | |
return a integer where all the bits between positions i and j (both inclusive) | |
are set to 1. The bits outside of this range shall not be modified. | |
*/ | |
//Comments assuming 8 bit numbers | |
//Goal is to make a mask with 1's at positions j through i | |
public static int setBetween(int n, int i, int j){ //n = 00010000, i = 3, j = 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
//We can do this with only one loop | |
//thanks to the fact that we are looking for | |
//EXACTLY 2 movies which match the length. | |
//Duplicates are not being counted | |
//as we check for a hit FIRST and then put the | |
//value of the first movie into the map. | |
public static boolean isTwoMovies(int fl, int[] ml){ | |
HashMap<Integer, Boolean> hm = new HashMap<Integer, Boolean >(); |
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
public class RomanConversion { | |
public static void main(String[] args){ | |
System.out.println(toRoman(1904)); | |
} | |
public static String toRoman(int x){ | |
StringBuilder sb = new StringBuilder(); | |
String number = x + ""; |
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
/** | |
* Find the greatest number in an array with a multi-threaded fork/join approach. | |
* | |
* This is a simple recursive divide&conquer approach to search through a list | |
* and return the max-element. It is using a subclass of java.util.concurrent.ForkJoinTask | |
* (namely RecursiveTask<V>). | |
* | |
* Theoretical aspect: Amdahl's Law. | |
* Possible speedup with n processors: S(n) = 1 / (B + 1-B*(1/n)) | |
* where B is the fractal of the programm which can only be |
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
/** | |
* Decide whether a given string or ANY | |
* of its permutations is a Palindrome. | |
* | |
* The given solution works in O(n). Building the parity map | |
* takes n steps, iterating through the map takes | |
* not more than n steps (size of the alphabet). | |
* Space consumption: Map with the size of the alphabet. (constant) | |
* @param str | |
* @return |
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
//This method works only with integers | |
int a = 5; | |
int b = 7; | |
a = a-b; //diff. a = -2 | |
b = a+b; // b = 5 | |
a = b-a; // a = 7 | |
//This method relies on bit manipulation and does not depend on the number format | |
int c = 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
//return -1: correct parentheses | |
//return n: Position of first offending bracket | |
public static int parantheses(char[] chrs){ | |
Stack s = new Stack(); | |
int i = 0; | |
for(;i<chrs.length;i++){ //Checks for erroneous chars omitted | |
char c = chrs[i]; |
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
/*You have an array of integers, and for each index you want to find the product | |
of every integer except the integer at that index. | |
Write a function get_products_of_all_ints_except_at_index() that takes an array | |
of integers and returns an array of the products.*/ | |
public static int[] get_products_of_all_ints_except_at_index_dp(int[] arr){ | |
//build front | |
int[] front = new int[arr.length]; | |
front[0] = 1; | |
for(int i = 1; i < arr.length; i++){ |
NewerOlder