Skip to main content

Posts

Showing posts from August, 2021

Max Min Hackerrank Solution - java

 Max Min 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 'maxMin' function below.      *      * The function is expected to return an INTEGER.      * The function accepts following parameters:      *  1. INTEGER k      *  2. IN...

The Report Hackerrank Solution - SQL | Hackerrank SQL

 The Report Hackerrank Solution - SQL For Explanation Watch Video :  Code ::  SELECT CASE        WHEN G.GRADE >= 8 THEN S.NAME        ELSE 'NULL' END,G.GRADE,S.MARKS        FROM STUDENTS S,GRADES G        WHERE S.MARKS >= MIN_MARK AND S.MARKS <=MAX_MARK        ORDER BY G.GRADE DESC,S.NAME,S.MARKS;

Tree : Top View Hackerrank Solution - java

Tree : Top View Hackerrank Solution for explanation watch Video :  Code:  import  java.util.*; import  java.io.*; class  Node {     Node left;     Node right;      int  data;          Node( int  data) {          this .data = data;         left = null;         right = null;     } } class  Solution {      /*           class Node          int data;         Node left;         Node right;     */      static   cla...

Tree: Level Order Traversal Hackerrank Solution - java | Hackerrank Data Structures

 Tree: Level Order Traversal Hackerrank Solution - java For Explanation Watch Video :  Code import  java.util.*; import  java.io.*; class  Node {     Node left;     Node right;      int  data;          Node( int  data) {          this .data = data;         left = null;         right = null;     } } class  Solution {      /*           class Node          int data;         Node left;         Node right;     */     ...

Hash Tables: Ransom Note Hackerrank Solution - java | Hackerrank

 Hash Tables: Ransom Note 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 'checkMagazine' function below.      *      * The function accepts following parameters:      *  1. STRING_ARRAY magazine      *  2. STRING_ARRAY note      */      public ...

Placements Hackerrank Solution SQL | Hackerrank SQL

 Placements Hackerrank Solution SQL For Explanation Watch Video :  Code : SELECT NAME FROM STUDENTS S,FRIENDS F,PACKAGES P1,PACKAGES P2 WHERE S.ID=F.ID AND S.ID=P1.ID AND F.FRIEND_ID=P2.ID AND P1.SALARY < P2.SALARY ORDER BY P2.SALARY;

Jumping on the Clouds Hackerrank Solution - java

 Jumping on the Clouds 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; public   class  Solution {      public   static   void  main(String[] args)  throws  IOException {         Scanner scn =  new  Scanner(System.in);          int  n = scn.nextInt();          int [] arr =  new   int [n];        ...

Repeated String Hackerrank Solution - java

 Repeated String 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  noOfA(String s, long  rem){          int  count =  0 ;          for ( int  i= 0 ;i<rem;i++){              if (s.charAt(i)== 'a' ){                 count++;  ...

Any or All Hackerrank Solution Python | Hackerrank Python

 Any or All Hackerrank Solution Python For Explanation Watch Video :  Code: siz = int(input()) lst = list(input().split()) pos = all([int(i)>0 for i in lst]) pal = any([st == st[::-1] for st in lst]) print(pos and pal)#true 

Program to find the frequency of characters in given string in java

Program to find the frequency of characters in given string in java  For Explanation Watch Video : Code:: import java.util.*; import java.io.*; import java.lang.*; class Test{ public static void main(String[] args) { String name = "idiot"; Map<Character,Integer> map = new HashMap<Character,Integer>(); for(int i=0;i<name.length();i++){ Character ch = name.charAt(i); map.put(ch,map.getOrDefault(ch,0)+1); } System.out.println(map); for(Map.Entry<Character,Integer> e : map.entrySet()){ System.out.println(e.getKey()+" "+e.getValue()); } } } o/p: {d=1, t=1, i=2, o=1} d 1 t 1 i 2 o 1