Skip to main content

Posts

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];          for ( int  i= 0 ;i<n;i++){             arr[i] = scn.nextInt();         }          if (n== 2  || n== 3 ){             System.out.println( 1 );         } else { // n=6  0 0 0 0 1 0              int  i= 0 ;              int  count =  0 ;              while (i<=n- 2 ){                  if ((i+ 2 )<n && arr[i+ 2 ]!= 1 ){                    

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++;             }         }          return  count;     }      public   static   long  repeatedString(String s,  long  n) {          int  a_count =  0 ;          for ( int  i= 0 ;i<s.length();i++){              if (s.charAt(i)== 'a' ){                 a_count++;             }         }          long  rem = n % s.length();          if (rem== 0 ){              return

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

Python Evaluation Hackerrank Solution | Hackerrank Python

 Python Evaluation Hackerrank Solution For Explanation Watch Video : Code:: # Enter your code here. Read input from STDIN. Print output to STDOUT eval(input())

Draw The Triangle 2 Hackerrank Solution - SQL

 Draw The Triangle 2 Hackerrank Solution - SQL  for explanation watch video: Code:: set serveroutput on; declare res clob; begin  for i in 1..20 loop      res := '';      for j in 1..i loop        res := res || '*' || ' ';      end loop;      dbms_output.put_line(res);  end loop; end; /