Skip to main content

Posts

Hackerrank Designer PDF Viewer Solution - Java

 Hackerrank Designer PDF Viewer 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 'designerPdfViewer' function below.      *      * The function is expected to return an INTEGER.      * The function accepts following parameters:      *  1. INTEGER_ARRAY h      *  2. STRING word      */      public   static   int  designerPdfViewer(List<Integer> h, String word) {          int  max = - 1 ;          for ( int  i= 0 ;i<word.length();i++){              char  ch = word.charAt(i);              int  ascii = ( int )ch -  97 ;              int  val = h.get(ascii);              if (val>max){               

Drop Command (DDL) in SQL Oracle With Implementation

 Drop Command (DDL) in SQL Oracle With Implementation For Explanation Watch Video:: Drop Command Used to delete  table (rows X columns) EX::: 1)Create table SQL> create table emp01(fname varchar2(15),sal Number(10)); Table created. 2)Describe table SQL> desc emp01;  Name                                      Null?    Type  ----------------------------------------- -------- ----------------------------  FNAME                                              VARCHAR2(15)  SAL                                                NUMBER(10) SQL> select * from emp01; no rows selected 3)Insert values into table SQL> insert into emp01 values('smith',500000); 1 row created. 4)Drop the table SQL> drop table emp01; Table dropped. 5)TO see columns deleted again describe table SQL> desc emp01; ERROR: ORA-04043: object emp01 does not exist 6_to see data deleted SQL> select * from emp01; select * from emp01               * ERROR at line 1: ORA-00942: table or view does not exist

Hackerrank Write a function Solution - Python

 Hackerrank Write a function Solution - Python For Explanation Watch Video:: Code:: def  is_leap(year):     leap =  False           if  year %  400  ==  0 :         leap =  True      elif  year% 4 == 0   and  year% 100 != 0 :         leap= True      return  leap year =  int ( input ()) print (is_leap(year))

Hackerrank Sales by Match Solution - Java

Hackerrank Sales by Match 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 'sockMerchant' function below.      *      * The function is expected to return an INTEGER.      * The function accepts following parameters:      *  1. INTEGER n      *  2. INTEGER_ARRAY ar      */      public   static   int  sockMerchant( int  n, List<Integer> ar) {          int  count =  0 ;         HashSet<Integer> hs =  new  HashSet<>();          for ( int  i= 0 ;i<n;i++){              int  num = ar.get(i);              if (!hs.contains(num)){                 hs.add(num);             } else {              

JDBC program for truncate table

 JDBC program for truncate table for explanation watch video:: Before Execution Of Program:: SQL> select * from test1;        EID ENAME ---------- ----------          1 raja          2 Jhon CODE:: import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.*; public class College { public static void main(String[] args)throws Exception{ Connection con =  DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","system","tiger"); Statement st = con.createStatement(); //write query String query = "truncate table test1"; //execute  int count = st.executeUpdate(query); if(count==0){ System.out.println("Table is truncated"); }else{ System.out.println("Table is not truncated"); } con.close(); } } After Execution of Program:: ====================== SQL> select * from test1;

JDBC application For Dropping table

 JDBC application For Dropping table For Explanation Watch Video::: Before Execution Of code:: SQL> desc test2;  Name                                      Null?    Type  ----------------------------------------- -------- ----------------------------  EID                                                NUMBER(38)  ENAME                                              VARCHAR2(10) Code::: import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.*; public class College { public static void main(String[] args)throws Exception{ Connection con =  DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","system","tiger"); Statement st = con.createStatement(); //query String query = "drop table test2"; //execute the query int count = st.executeUpdate(query); if(count==0){ System.out.println("Table is dropped

Creating table Using JDBC Application

 Creating table Using JDBC Application For Explanation Watch Video: EX1:: Code:: import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.*; public class Test1 { public static void main(String[] args)throws Exception{ Connection con =  DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","system","tiger"); Statement st = con.createStatement(); //query String query = "create table test2(eid int,ename varchar2(10))"; //execute the query int count = st.executeUpdate(query); if(count==0){ System.out.println("Table is created"); }else{ System.out.println("Table is not created"); } con.close(); } } After Execution Of Program Table:: SQL> desc test2;  Name                                      Null?    Type  ----------------------------------------- -------- ------------