Skip to content

Instantly share code, notes, and snippets.

View kylelong's full-sized avatar
🌴
On vacation

Kyle Long kylelong

🌴
On vacation
View GitHub Profile
@kylelong
kylelong / oneFive.java
Last active January 14, 2019 08:32
Week 1/13/19 of cassido's newsletter interview question of the week.
import java.util.*;
/**
* Returns all numbers < n whose digits are 1 or 5.
* Created by Kyle Long on 1/14/19.
*/
public class oneFive {
public static void main(String [] args){
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
@kylelong
kylelong / pointers.txt
Created January 9, 2019 02:14
Questions about pointers from cassido's 1/7/19 newsletter
- What is the difference between passing by value and passing by reference?
By value: Passes the value of the memory address that the pointer points to.
By reference: Passes an alias to “reference” the variable passed in.
- How can pointers be used with inherited or abstract classes?
Using static methods.
- What does it mean for a pointer to be null?
The pointer does not point to any address in memory.
@kylelong
kylelong / greaterPower.java
Last active December 24, 2018 07:13
Return string form of power function
/**
* Created by kylel95 on 12/24/18.
*/
public class greaterPower {
public static void main(String [] args){
int a = 3;
int b = 5;
int c = 2;
int d = 4;
System.out.println(greaterPow(a, b));
@kylelong
kylelong / day5.java
Created December 14, 2018 18:38
adventofcodeday5
/**
* Created by kylel95 on 12/5/18.
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class day5 {
public static void main(String [] args) {
Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
@kylelong
kylelong / nonprimefactors.java
Last active December 13, 2018 06:14
Calculates the number of non-prime factors a number has.
/**
* Created by kylel95 on 12/13/18.
*/
import java.io.*;
import java.util.*;
/**
* Calculate number of non-prime factors of a number N
*/
public class nonprimefactors {
@kylelong
kylelong / balancedNumber.java
Created November 23, 2018 03:10
Function to determine if the frequency of digits in a given number is balanced.
/**
* Created by kylel95 on 11/22/18.
*/
import java.util.*;
public class balancedNumber {
// Write a function to determine if the frequency of digits in a given number is balanced.
public static void main (String [] args){
System.out.println(freq(1337));
System.out.println(freq(3.1415926535));
System.out.println(freq(12345678));
@kylelong
kylelong / fiftysum.java
Created November 3, 2018 14:34
Given a set of numbers -50 to 50, find all pairs that add up to a given sum. Week of 10/28/2018 cassido newsletter interview problem
/**
Given a set of numbers -50 to 50, find all pairs that add up to a given sum.
* Created by kylel95 on 11/3/18.
*/
import java.util.*;
public class fiftysum {
public static void main(String [] args){
int [] arr = new int[101];
int index = 0;
for(int i = -50; i <= 50; i++){