diff --git a/Hackerrank/First.java b/Hackerrank/First.java new file mode 100644 index 0000000..3c9118b --- /dev/null +++ b/Hackerrank/First.java @@ -0,0 +1,28 @@ + import java.io.*; +import java.util.*; +import java.text.*; +import java.math.*; +import java.util.regex.*; + +public class Solution { +//This is a practice problem from hackerrank solve me first + + + static int solveMeFirst(int a, int b) { + // Hint: Type return a+b; below + + } + + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + int a; + a = in.nextInt(); + int b; + b = in.nextInt(); + int sum; + sum = solveMeFirst(a, b); + System.out.println(sum); + } +} + + diff --git a/Hackerrank/Hashmap.java b/Hackerrank/Hashmap.java new file mode 100644 index 0000000..4b81693 --- /dev/null +++ b/Hackerrank/Hashmap.java @@ -0,0 +1,30 @@ + +//Complete this code or write your own from scratch +import java.util.*; +import java.io.*; + +class Hashmap{ + public static void main(String []argh) + { + Scanner x = new Scanner(System.in); + int n=x.nextInt(); + x.nextLine(); + Map map = new HashMap(); + for(int i=0;i oddIndexes = new ArrayList<>(100); + for(int j= 0; j < word.length();j++){ + if(j % 2 == 0){ + System.out.print(word.charAt(j)); + }else{ + oddIndexes.add(j); + } + } + System.out.print(" "); + for(Integer index : oddIndexes){ + System.out.print(word.charAt(index)); + } + System.out.println(); + } + }} + diff --git a/Hackerrank/Simplearray.java b/Hackerrank/Simplearray.java new file mode 100644 index 0000000..b5b4897 --- /dev/null +++ b/Hackerrank/Simplearray.java @@ -0,0 +1,43 @@ + +import java.io.*; +import java.math.*; +import java.text.*; +import java.util.*; +import java.util.regex.*; + +public class Simplearray { + + /* + * Complete the simpleArraySum function below. + */ + static int simpleArraySum(int[] ar) { + /* + * Write your code here. + */ + + } + + private static final Scanner scanner = new Scanner(System.in); + + public static void main(String[] args) throws IOException { + BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH"))); + + int arCount = Integer.parseInt(scanner.nextLine().trim()); + + int[] ar = new int[arCount]; + + String[] arItems = scanner.nextLine().split(" "); + + for (int arItr = 0; arItr < arCount; arItr++) { + int arItem = Integer.parseInt(arItems[arItr].trim()); + ar[arItr] = arItem; + } + + int result = simpleArraySum(ar); + + bufferedWriter.write(String.valueOf(result)); + bufferedWriter.newLine(); + + bufferedWriter.close(); + } +}