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.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(); |
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
- 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. | |
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
/** | |
* 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)); |
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
/** | |
* 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))); |
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
/** | |
* 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 { |
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
/** | |
* 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)); |
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 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++){ |
NewerOlder