Skip to content

Commit 34ae95d

Browse files
committed
Added Stacks, Queues, React and String to Int
1 parent d671039 commit 34ae95d

File tree

5 files changed

+81
-0
lines changed

5 files changed

+81
-0
lines changed

.DS_Store

0 Bytes
Binary file not shown.

DataStructures/BBQ.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import java.util.LinkedList;
2+
import java.util.Queue;
3+
4+
public class BBQ {
5+
6+
public static void main(String[] args) {
7+
8+
Queue<String> q = new LinkedList<String>();
9+
10+
q.add("A");
11+
q.add("B");
12+
q.add("C");
13+
14+
System.out.println(q.poll());
15+
16+
}
17+
18+
}

DataStructures/StacksRFun.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import java.util.Stack;
2+
3+
public class StacksRFun {
4+
5+
public static void main(String[] args) {
6+
7+
// Y
8+
// B
9+
// R
10+
11+
Stack<Character> tower = new Stack<Character>();
12+
13+
tower.add('R');
14+
tower.add('B');
15+
tower.add('Y');
16+
17+
System.out.println(tower.size());
18+
19+
}
20+
21+
}

Numbers/StringInteger.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
public class StringInteger {
3+
4+
public static void main(String[] args) {
5+
6+
String s = "age: 47";
7+
s = s.replaceAll("\\D+","");
8+
9+
int n = Integer.parseInt(s);
10+
11+
System.out.println(n + 2);
12+
13+
}
14+
15+
}

Programs/ReactFAST.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import java.util.Scanner;
2+
3+
public class ReactFAST {
4+
5+
public static void main(String[] args) throws InterruptedException {
6+
7+
System.out.println("3");
8+
Thread.sleep(1000);
9+
System.out.println("2");
10+
Thread.sleep(1000);
11+
System.out.println("1");
12+
Thread.sleep(1000);
13+
14+
System.out.println("GO!!!!!!!!!");
15+
long startTime = System.currentTimeMillis();
16+
17+
Scanner s = new Scanner(System.in);
18+
s.next();
19+
long stopTime = System.currentTimeMillis();
20+
21+
long reactionTime = stopTime - startTime;
22+
23+
System.out.println(reactionTime + "ms");
24+
25+
}
26+
27+
}

0 commit comments

Comments
 (0)