Skip to main content

Posts

Showing posts with the label Hackerrank

Population Census hackerrank Solution

Population Census hackerrank Solution for explanation watch video: Code:: select sum(city.population) from city inner join country on CITY.CountryCode = COUNTRY.Code where country.CONTINENT = 'Asia';

Linux Shell - Arithmetic Operations solution

 Linux Shell - Arithmetic Operations solution for explanation watch video:: code:: read string res= $(echo "scale=4;$string" | bc) printf  "%.3f"   "$res"  

Weather Observation Station 19 Hackerrank Solution - SQL

  Weather Observation Station 19 Hackerrank Solution - SQL  for explanation watch video :: Code:: select round(sqrt(     power(max(lat_n)-min(lat_N),2)+     power(max(long_w)-min(long_w),2) ),4) from station;

Weather Observation Station 15 Hackerrank Solution - SQL

 Weather Observation Station 15 Hackerrank Solution - SQL For explanation watch video :: Code:: select round(long_w,4) from station where lat_n = (select max(lat_n) from station where lat_n<137.2345);

Weather Observation Station 14 Hackerrank Solution - SQL

Weather Observation Station 14 Hackerrank Solution - SQL For explanation watch video :: Code:: select round(max(LAT_N),4) from station where LAT_N < 137.2345;

Weather Observation Station 18 Hackerrank Solution - SQL

Weather Observation Station 18 Hackerrank Solution - SQL For explanation watch video :: Code:: select round(abs(max(lat_n)-min(lat_n))+abs(max(long_w)-min(long_w)),4) from station;

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);

Weather Observation Station 16 Hackerrank Solution - SQL

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

Weather Observation Station 2 Hackerrank Solution - SQL

 Weather Observation Station 2 Hackerrank Solution - SQL For Explanation watch video::: Code:: select round(sum(LAT_N),2),round(sum(LONG_W),2) from station;

Modified Kaprekar Numbers Hackerrank Solution - java

 Modified Kaprekar Numbers 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 'kaprekarNumbers' function below.      *      * The function accepts following parameters:      *  1. INTEGER p      *  2. INTEGER q      */     public static void kaprekarNumbers(int p, int q) {         ArrayList<Long> al = new ArrayList<>();         for(long i=p;i<=q;i++){             long sq = i*i;           ...

equalize the array hackerrank solution in java

 equalize the array hackerrank solution in 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 'equalizeArray' function below.      *      * The function is expected to return an INTEGER.      * The function accepts INTEGER_ARRAY arr as parameter.      */     public static int equalizeArray(List<Integer> arr) {                 HashMap<Integer,Integer> hm = new HashMap<>();         for(int i=0;i<arr.size();i++){             hm.put(arr.get...

Library Fine Hackerrank Solution - java

 Library Fine 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 'libraryFine' function below.      *      * The function is expected to return an INTEGER.      * The function accepts following parameters:      *  1. INTEGER d1      *  2. ...

Sequence Equation Hackerrank Solution - java

 Sequence Equation 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 'permutationEquation' function below.      *      * The function is expected to return an INTEGER_ARRAY.      * The function accepts INTEGER_ARRAY p as parameter.      */      public   s...

Chocolate Feast Hackerrank Solution - java

Chocolate Feast 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 'chocolateFeast' function below.      *      * The function is expected to return an INTEGER.      * The function accepts following parameters:      *  1. INTEGER n      *  2. INTEGER c      *  3. INTEGER m      */     public static int chocolateFeast(int n, int c, int m) {         //no of  chocolate          int num = n/c;         int w...

Sherlock and Squares Hackerrank Solution - java

Sherlock and Squares 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 {      public   static   int  squares( int  a,  int  b) {          int  first = ( int )Math.ceil(Math.sqrt(a));          int  last = ( int )Math.floor(Math.sqrt(b));          return  last - first + 1 ;     } } public   class  Solution ...

Diagonal Difference Hackerrank Solution - java

 Diagonal Difference 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 'diagonalDifference' function below.      *      * The function is expected to return an INTEGER.      * The function accepts 2D_INTEGER_ARRAY arr as parameter.      */      public   static ...

The Blunder Hackerrank Solution - SQL

 The Blunder Hackerrank Solution - SQL For explanation watch video :: Code: select ceil(avg(salary)-avg(replace(salary,'0',''))) from Employees;

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);            ...