Skip to main content

Posts

Showing posts with the label hackerrank solutions

Weather Observation Station 17 Hackerrank Solution - SQL

 Weather Observation Station 17 Hackerrank Solution - SQL for explanation watch video :: Code:: select round(long_w,4) from station where lat_n = (select min(lat_n) from station where lat_n>38.7780);

A Very Big Sum Hackerrank Solution - java

 A Very Big Sum Hackerrank Solution - java for explanation watch video : Code:: import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.function.*; import java.util.regex.*; import java.util.stream.*; import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toList; class Result {     /*      * Complete the 'aVeryBigSum' function below.      *      * The function is expected to return a LONG_INTEGER.      * The function accepts LONG_INTEGER_ARRAY ar as parameter.      */     public static long aVeryBigSum(List<Long> ar) {         long sum = 0;         for(int i=0;i<ar.size();i++){             sum = sum + ar.get(i);         }         return sum;     } } public class Solution {     public static void main(String[] args) throws IOException {         BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));         Buf

java hashset hackerrank solution - java 15

 java hashset hackerrank solution - java 15 for explanation watch video: code: import  java.io.*; import  java.util.*; public   class  Solution {      public   static   void  main(String[] args) {         Scanner scn =  new  Scanner(System.in);          int  t = scn.nextInt();         scn.nextLine();         HashSet<String> hs =  new  HashSet<>();          for ( int  i= 0 ;i<t;i++){             String s = scn.nextLine();             hs.add(s);             System.out.println(hs.size());         }     } }

java map hackerrank solution - Java 15

   java map hackerrank solution - Java 15 for explanation watch video : Code: import  java.io.*; import  java.util.*; public   class  Solution {      public   static   void  main(String[] args) {         Scanner scn =  new  Scanner(System.in);          int  n = scn.nextInt();         scn.nextLine();         HashMap<String,Integer> hm =  new  HashMap<>();          for ( int  i= 0 ;i<n;i++){             String name = scn.nextLine();              int  mobile = scn.nextInt();             scn.nextLine();             hm.put(name,mobile);         }          while (scn.hasNext()){             String name = scn.nextLine();              if (hm.containsKey(name)){                 System.out.println(name+ "=" +hm.get(name));             } else {                 System.out.println( "Not found" );             }         }        } }