This file contains hidden or 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.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.HashMap; | |
import java.util.stream.Collectors; | |
/** | |
* Suppose you have a comma-separated list of merchants, the platforms they’re on, |
This file contains hidden or 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 function estimates the average of two six-digit hexadecimal colors. | |
* The function assumes that the inputs are valid. | |
* @param {*} color1 // first hexadecimal color | |
* @param {*} color2 // second hexadecimal color | |
* @author Vivek Narang | |
*/ | |
function avgColor(color1, color2) { |
This file contains hidden or 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 a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. | |
An example is the root-to-leaf path 1->2->3 which represents the number 123. Find the total sum of all root-to-leaf numbers. | |
Question: https://leetcode.com/problems/sum-root-to-leaf-numbers/ | |
/** | |
* Definition for a binary tree node. | |
* public class TreeNode { | |
* int val; | |
* TreeNode left; | |
* TreeNode right; |
This file contains hidden or 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 Solution { | |
public boolean isIsomorphic(String s, String t) { | |
if (s.length() != t.length()) { | |
return false; | |
} | |
Map<Character, Character> aMap = new HashMap<Character, Character>(); | |
Map<Character, Character> bMap = new HashMap<Character, Character>(); | |
This file contains hidden or 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
package edu.uga; | |
import java.util.Collections; | |
import java.util.LinkedList; | |
import java.util.List; | |
import java.util.Scanner; | |
public class Test { | |
public static void main(String[] args) { |
This file contains hidden or 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
thisApt = null; | |
for (int i = 0 ; i < apts.length ; i++) { | |
if (apts[i].getAptID() == theAptID) { | |
thisApt = apts[i]; | |
break; | |
} | |
} | |
if (thisApt == null) { |
This file contains hidden or 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 void printEmpData(int id) | |
{ | |
boolean exists = false; | |
System.out.println("ID" + " " + "Name" + " " + "Hours" + " " + "Salary"); | |
System.out.println("-------------------------"); | |
for(int i = 0; i < employeePayroll.length; i++) { | |
if (employeePayroll[i].getId() == id) { | |
exists = true; |
This file contains hidden or 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.util.Scanner; | |
public class ArraysKeyValue { | |
public static void main (String [] args) { | |
final int NUM_ROWS = 2; | |
final int NUM_COLS = 2; | |
int [][] milesTracker = new int[NUM_ROWS][NUM_COLS]; | |
int i; | |
int j; | |
int maxMiles; // Assign with first element in milesTracker before loop |
This file contains hidden or 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.util.Scanner; | |
public class FindMatchValue { | |
public static void main (String [] args) { | |
final int NUM_VALS = 4; | |
int[] userValues = new int[NUM_VALS]; | |
int i; | |
int matchValue; | |
int numMatches = -99; // Assign numMatches with 0 before your for loop |
This file contains hidden or 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 OOPExample { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
Numbers num = new Numbers(1, 2); | |
System.out.println(num.sum()); | |
Numbers num2 = new Numbers(); |
NewerOlder