diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 839607f..ed51732 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -25,7 +25,8 @@
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
- "last_opened_file_path": "C:/Users/39389/Documents/Repository/HackerJava"
+ "last_opened_file_path": "C:/Users/39389/Documents/Repository/HackerJava",
+ "settings.editor.selected.configurable": "preferences.pluginManager"
}
}]]>
diff --git a/SeventhWave/1darray2.java b/SeventhWave/1darray2.java
new file mode 100644
index 0000000..d816820
--- /dev/null
+++ b/SeventhWave/1darray2.java
@@ -0,0 +1,61 @@
+import java.io.*;
+import java.util.*;
+import java.text.*;
+import java.math.*;
+import java.util.regex.*;
+
+public class Solution {
+ public static void main(String[] args) {
+ Scanner scanner = new Scanner(System.in);
+ int t = Integer.parseInt(scanner.nextLine());
+ for (int i = 0; i < t; i++) {
+ int n = scanner.nextInt();
+ int m = scanner.nextInt();
+ int[] arr = new int[n];
+ for (int j = 0; j < n; j++) {
+ arr[j] = scanner.nextInt();
+ }
+ solve(n, m, arr);
+ }
+ }
+
+ public static void solve(int n, int m, int[] arr) {
+ if (solve(n, m, arr, new boolean[n], 0)) {
+ System.out.println("YES");
+ } else {
+ System.out.println("NO");
+ }
+ }
+
+ public static boolean solve(int n, int m, int[] arr, boolean[] visited, int curr) {
+ if (curr + m >= n || curr + 1 == n) {
+ return true;
+ }
+
+ boolean[] newVisited = new boolean[n];
+ for (int i = 0; i < n; i++) {
+ newVisited[i] = visited[i];
+ }
+
+ boolean s = false;
+ if (!visited[curr + 1] && arr[curr + 1] == 0) {
+ newVisited[curr + 1] = true;
+ s = solve(n, m, arr, newVisited, curr + 1);
+ }
+ if (s) {
+ return true;
+ }
+ if (m > 1 && arr[curr + m] == 0 && !visited[curr + m]) {
+ newVisited[curr + m] = true;
+ s = solve(n, m, arr, newVisited, curr + m);
+ }
+ if (s) {
+ return true;
+ }
+ if (curr > 0 && arr[curr - 1] == 0 && !visited[curr - 1]) {
+ newVisited[curr - 1] = true;
+ s = solve(n, m, arr, newVisited, curr - 1);
+ }
+ return s;
+ }
+}
\ No newline at end of file
diff --git a/SeventhWave/arraylist.java b/SeventhWave/arraylist.java
new file mode 100644
index 0000000..016c7a4
--- /dev/null
+++ b/SeventhWave/arraylist.java
@@ -0,0 +1,40 @@
+import java.io.*;
+import java.util.*;
+import java.text.*;
+import java.math.*;
+import java.util.regex.*;
+
+public class Solution {
+
+ public static void main(String[] args) {
+ /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
+ Scanner scan = new Scanner(System.in);
+
+ int total = scan.nextInt();
+
+ ArrayList> mainlist = new ArrayList<>();
+
+ for (int i = 0; i < total; i++) {
+ int size = scan.nextInt();
+ ArrayList list = new ArrayList();
+
+ for (int j = 0; j < size; j++) {
+ int item = scan.nextInt();
+ list.add(item);
+ }
+ mainlist.add(list);
+ }
+
+ int totalprint = scan.nextInt();
+ for (int k = 0; k < totalprint; k++) {
+ int row = scan.nextInt();
+ int col = scan.nextInt();
+ try {
+ System.out.println(mainlist.get(row - 1).get(col - 1));
+ } catch (Exception e) {
+ System.out.println("ERROR!");
+ }
+ }
+ scan.close();
+ }
+}
\ No newline at end of file
diff --git a/SeventhWave/dstructures.java b/SeventhWave/dstructures.java
new file mode 100644
index 0000000..b1e9867
--- /dev/null
+++ b/SeventhWave/dstructures.java
@@ -0,0 +1,36 @@
+import java.io.*;
+import java.util.*;
+import java.text.*;
+import java.math.*;
+import java.util.regex.*;
+
+public class Solution {
+
+ public static void main(String[] args) {
+ try {
+ int no_of_entries = 0;
+ int i = 0;
+ String name = null;
+ int number = 0;
+ String query = null;
+ HashMap phoneBook = new HashMap();
+ BufferedReader b = new BufferedReader(new InputStreamReader(
+ System.in));
+ no_of_entries = Integer.parseInt(b.readLine());
+ while (i < no_of_entries) {
+ name = b.readLine();
+ number = Integer.parseInt(b.readLine());
+ phoneBook.put(name, number);
+ i++;
+ }
+ while (!(query = b.readLine().trim()).isEmpty()) {
+ if (phoneBook.containsKey(query))
+ System.out.println(query + "=" + phoneBook.get(query));
+ else
+ System.out.println("Not found");
+ }
+ } catch (Exception e) {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/SeventhWave/list.java b/SeventhWave/list.java
new file mode 100644
index 0000000..328a786
--- /dev/null
+++ b/SeventhWave/list.java
@@ -0,0 +1,38 @@
+import java.io.*;
+import java.util.*;
+import java.text.*;
+import java.math.*;
+import java.util.regex.*;
+
+public class Solution {
+
+ public static void main(String[] args) {
+ final Scanner in = new Scanner(System.in);
+ final int size = in.nextInt();
+ final List list = new LinkedList<>();
+ for (int i = 0; i < size; i++) {
+ list.add(in.nextInt());
+ }
+ final int commandCount = in.nextInt();
+ for (int i = 0; i < commandCount; i++) {
+ in.nextLine();
+ String command = in.nextLine();
+ if (command.equals("Insert")) {
+ int index = in.nextInt();
+ int value = in.nextInt();
+ list.add(index, value);
+ } else {
+ int index = in.nextInt();
+ list.remove(index);
+ }
+ }
+ int count = 0;
+ for (Integer number : list) {
+ System.out.print(number);
+ if (count != list.size() - 1) {
+ System.out.print(" ");
+ }
+ count++;
+ }
+ }
+}
\ No newline at end of file
diff --git a/SeventhWave/stack.java b/SeventhWave/stack.java
new file mode 100644
index 0000000..670d6cc
--- /dev/null
+++ b/SeventhWave/stack.java
@@ -0,0 +1,39 @@
+import java.io.*;
+import java.util.*;
+import java.text.*;
+import java.math.*;
+import java.util.regex.*;
+
+public class Solution {
+
+ public static boolean isBalanced(String s) {
+ Stack stack = new Stack();
+ for (int i = 0; i < s.length(); ++i) {
+ if (s.charAt(i) == '(') stack.push('(');
+ else if (s.charAt(i) == '{') stack.push('{');
+ else if (s.charAt(i) == '[') stack.push('[');
+ else if (s.charAt(i) == ')') {
+ if (stack.isEmpty()) return false;
+ if (stack.pop() != '(') return false;
+ } else if (s.charAt(i) == '}') {
+ if (stack.isEmpty()) return false;
+ if (stack.pop() != '{') return false;
+ } else if (s.charAt(i) == ']') {
+ if (stack.isEmpty()) return false;
+ if (stack.pop() != '[') return false;
+ }
+ }
+ return stack.isEmpty();
+ }
+
+ public static void main(String[] args) {
+ Stack stack = new Stack();
+ Scanner sc = new Scanner(System.in);
+ String line;
+ while (sc.hasNextLine()) {
+ line = sc.nextLine();
+ if (isBalanced(line)) System.out.println("true");
+ else System.out.println("false");
+ }
+ }
+}
\ No newline at end of file