Top Social

International Coding Contest

we will basically build a top program list which is important for National and International Coding Contest. Guys if you are interested for a scored high score and want to get selected for a final round then after participating please prefer my blog, On my blog definitely achieved your goal.

Image Slider

LightBlog
20 August, 2019

How To Prepaire for Product Besed Compnies

Hello everyone , I am very happy to making this blog viewer and I think its alos help me in future.

Topic :

Getting started with Competitive Programming - Build your algorithm skills

I started Competitive Programming as soon as I got into college, around 2014.
And I seriously continued with CP till 2015.
My career was only for a year. But I learned a lot during that time since it was my #1 priority.
Before we go any further, you might be thinking why I left CP.
This was because I got interested in open source back then, and creating cool GitHub projects became my new hobby.
Was that a good decision?
That only time with tell. But with the future plans I have, it seems to be a good decision.
So let's start this guide to Competitive Programming.

Step 1

Learn C, C++ or Java. If you can learn C, you can learn C++ and I will highly recommend that.
Why? Because C++ has the STL which has Set, Map, Vectors etc. These can come very instrumental in solving certain kinds of problems.
I have never used Java but seeing that some pro coders (uwi) like to use it, I think it's a good choice too.
Again, don't use Python, Ruby, etc, for CP. These are very high-level languages that won't give you as much control over your code as is needed.
And they are painfully slow.

Step 2

Get on Hackerrank.
I recommend Hackerrank because it has the best User Interface, combined with relative ease of getting started for the beginners.
Ease in the sense that anyone with zero CP/algorithms experience will be able to solve the first few questions.
You might get stuck after first 4-5 questions and that's normal. In that case, feel free to see the editorial or google to look for the solution.
When you find it, make sure to understand it, and then code it on your own.
First, solve "Easy" questions of all sections, and then "Medium" questions.
In fact, solving some "Medium" questions is good enough to call yourself a CP professional.

Step 3

Get on Codechef and Codeforces.
Codechef long contests are the best in the business, and Codeforces is well known for its 2 hr rounds.
Try to give both and see where you are good at.
Developing your Competitive Programming skills requires that you are both fast and are able to think deeply about a problem.
Codechef long challenges = Deep thinking AND Codeforces rounds = Fast coding
If you want to be good, you should try to be good in both these areas.
But it's fine if you are just good at long challenges (deep thinking) or just good with short contests (fast thinking), both will help you become a better programmer.

Step 4

You can try Topcoder if you want. Or just let it be.
With CP, if your goal is to get offers from Google HQ and likes, you will have to do it regularly. That is, give contests, try to rank higher, and build your rating.
Otherwise, you can just do it on the side and focus on building other practical skills.
These practical skills combined with your decent competitive programming experience will go a long way in helping you secure those jobs and internships you dreamed about.

Alternative Route

You might already have some CP experience and might be looking to learn some algorithms. In that case, go through this list of algorithms by Codechef. Practicing even the top 20 of the lot will make you an above average Competitive Programmer.
You can also find a good list of algorithms at GeeksForGeeks. They are separated by topics and you can learn the ones at the top OR the ones you have heard about.
25 March, 2018

HOW TO ACTIVATE WINDOWS OFFICE AND WINDOWS

Guys today we learn about how to activate windows office and windows machine.
In this session, we are going to learn step by step of activation process so guys ready.
Lt,s start......
https://youtu.be/XwPwVdujo0c

Initial Step

See my video


Please follow each and every step very carefully if any problem occurred then please comments.



For Activator Links are given below
Download Activator
Please Like and Subscribe for More Update.
Thanks.

Top 10 JAVA Coding Question For Placement With Solution

These questions are basically preparation for campus drive.
Mostly these problems prefer for written exams.



1.      Write a function to convert a decimal number string into a binary string. For example, String A contains “123” which is decimal value 123. Convert this string into a binary string                                                 
Solution:-
//This function gives exception ArrayIndexOutOfBoundsException
                public void DecimalToBinary( int number)
                {
                                int bin[] = new int[40];
                                int i=0;
                                while(number>0)
                                {
                                                bin[i++] = number%2;
                                                number=number/2;
                                }
                                System.out.println("Convrted binary number of 123 is :- ");
                                for(int k= i-1;k>=0;k--)
                                {
                                                System.out.print(bin[k]);
                                }
                               
                }
Output-
                //converted binary number of 123 is :-
                1111011



1.      Write a java program to take a read a csv file and print the same in output file. This csv file contains three column having numeric values. The output file should contain the sum of these numeric values

Solution:-
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.List;

public class ReadCSVfile_and_Print {

    public static void main(String[] args) throws Exception {

    File file = new File("v3mobile.csv");

    List<String> lines = Files.readAllLines(file.toPath(),
            StandardCharsets.UTF_8);

    for (String line : lines) {
        String[] array = line.split(",", -1);
        System.out.println(array[0]);
    }

}
}
//Second Solution
import java.io.BufferedReader;
import java.io.FileReader;
public class ReadCSVfile_and_Print {

    public static void main(String[] args) throws Exception {
        String splitBy = ",";
        BufferedReader br = new BufferedReader(new FileReader("v3mobile.csv"));
        String line = br.readLine();
        while(line!=null){
             String[] b = line.split(splitBy);
             System.out.println(b[0]);
        }
        br.close();
}
}             


3. Write a program to read value from a DB. The DB schema is as follows
a. User name: root
b. Password: root
c. Table name: test
d. Schema
i. Emp name varchar 200
ii. Emp age int 10

Solution:-
import java.sql.*;
import java.util.*;

 public class JavaDatabaseReaddata {
  public static void main(String[] args) throws ClassNotFoundException, SQLException {
        Class.forName("oracle.jdbc.driver.OracleDriver");
                                System.out.println("Driver Loaded .");
        Connection con =DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","root","root");
                                Statement st=con.createStatement();
                                ResultSet rs=st.executeQuery("select * from test");
                                while(rs.next())
                                {
                                                System.out.println(rs.getString(1)+" "+rs.getInt(2));
                                }
                                rs.close();
                                st.close();
                                con.close();
  }
 }



4. Write a java program to call a HTTP URL and print the output.
a. URL is http://127.0.0.1:3300/test?value=p .
Solution:-
//For Server Coding
import java.net.*;
import java.io.*;
import java.util.*;

class tcpdateserver
{
                public static void main(String args[])
                {
                                ServerSocket ss = null;
                                Socket cs;
                                PrintStream ps;
                                BufferedReader dis;
                                String inet;
                                try{
                                                ss = new ServerSocket(4444);
                                                System.out.println("PressvCtrl+c to quit ");
                                                while(true)
                                                {
                                                                cs = ss.accept();
                                                                ps = new PrintStream(cs.getOutputStream());
                                                                Date d=new Date();
                                                                ps.println(d);
                                                                dis = new BufferedReader(new                    InputStreamReader(cs.getInputStream()));
                                                                inet=dis.readLine();
                                                                System.out.println("Client System/Ip address is : "+inet);
                                                                ps.close();
                                                                dis.close();
                                                               
                                                }
                                }
                                catch(IOException e)
                                {
                                                System.out.println("The Exception is : "+e);
                                }
                }
}
//For Client Coding
import java.net.*;
import java.io.*;
class tcpdateclient
{
                public static void main(String args[])
                {
                                try{
                                                Socket soc;
                                                BufferedReader dis;
                                                String sdate;
                                                PrintStream ps;
                                                InetAddress ia=InetAddress.getLocalHost();
                                                if(args.length == 0)
                                                                soc=new Socket(InetAddress.getLocalHost(),4444);
                                                else
                                                                soc=new Socket(InetAddress.getByName(args[0]),4444);
                                                dis = new BufferedReader(new InputStreamReader(soc.getInputStream()));
                                                sdate = dis.readLine();
                                               
                                                System.out.println("The date/time on server is : "+sdate);
                                                ps=new PrintStream(soc.getOutputStream());
                                                ps.println(ia);
                                                ps.close();
                                               
                                }
                                catch(IOException e)
                                {
                                                System.out.println("The Exception is : "+e);
                                }
                }
}
//Output is :
//Server Computer
A:\Pravesh Tutorials\V3Mobile_For_Internshps>java tcpdateserver
PressvCtrl+c to quit
Client System/Ip address is : 127.0.0.1:3300/test?value=p .
//Cliect Computer
A:\Pravesh Tutorials\V3Mobile_For_Internshps>java tcpdateclient
The date/time on server is : Mon Mar 12 18:04:46 IST 2018


5. Write a java program to store the values in Hashmap (key, store) and then search those given value from the Hashmap and print it.
a. Name is key, age is value….so store the following
i. (Ram, 36), (shyam,30), (dharam,10) (ravi,)
Solution:-
import java.util.*;
class HashMapStore
{
            public static void main(String args[])
            {
                        HashMap<String, Integer> hm = new HashMap<String, Integer>();
                        //store the values in Hashmap
                       
                        hm.put("Ram",36);
        hm.put("Shyam",30);
        hm.put("dharam",10);
        hm.put("ravi",null);
                        System.out.println(hm);
                       
                        //search these value from the Hashmap and print it.
                       
        Iterator entries = hm.entrySet().iterator();
        while (entries.hasNext()) {
            Map.Entry entry = (Map.Entry) entries.next();
            String key = (String)entry.getKey();
            Integer value = (Integer)entry.getValue();
            System.out.println("Key = " + key + ", Value = " + value);
        }
    }
}

6. Write a HTTP server process that take the above URL and print the receive value and send back the response.
a. The response is I received p.
Solution:-

//For Server Coding

import java.net.*;
import java.io.*;
import java.util.*;

class tcpdateserver
{
                public static void main(String args[])
                {
                                ServerSocket ss = null;
                                Socket cs;
                                PrintStream ps;
                                BufferedReader dis;
                                String inet;
                                try{
                                                String str = " ";
                                    String str2 = " ";
                                                ss = new ServerSocket(4444);
                                                System.out.println("PressvCtrl+c to quit ");
                                                while(true)
                                                {
                                                                cs = ss.accept();
                                                                ps = new PrintStream(cs.getOutputStream());
                                                                Date d=new Date();
                                                                ps.println(d);
                                                                dis = new BufferedReader(new InputStreamReader(cs.getInputStream()));
                                                                inet=dis.readLine();
                                                                System.out.println("Client System/Ip address is : "+inet);
                                                                DataInputStream din = new DataInputStream(s.getInputStream());
                                                                DataOutputStream dout=new DataOutputStream(s.getOutputStream());
                                                                str = din.readUTF();
                                                                System.out.println("Client Says : "+str);
                                                                dout.writeUTF(str2);
                                                    dout.flush();
                                                                ps.close();
                                                                din.close();
                                                                dout.close();
                                                                dis.close();
                                                               
                                                }
                                }
                                catch(IOException e)
                                {
                                                System.out.println("The Exception is : "+e);
                                }
                }
}
//For Client Coding
import java.net.*;
import java.io.*;
class tcpdateclient
{
                public static void main(String args[])
                {
                                String str = " ";
                                String str2 = " ";
                                try{
                                                Socket soc;
                                                BufferedReader dis;
                                                String sdate;
                                                PrintStream ps;
                                                InetAddress ia=InetAddress.getLocalHost();
                                               
                                                if(args.length == 0)
                                                                soc=new Socket(InetAddress.getLocalHost(),4444);
                                                else
                                                                soc=new Socket(InetAddress.getByName(args[0]),4444);
                                                dis = new BufferedReader(new InputStreamReader(soc.getInputStream()));
                                                sdate = dis.readLine();
                                               
                                                System.out.println("The date/time on server is : "+sdate);
                                               
                                                ps=new PrintStream(soc.getOutputStream());
                                                DataInputStream din = new DataInputStream(s.getInputStream());
                                    DataOutputStream dout=new DataOutputStream(s.getOutputStream());
                                                str = din.readUTF();
                                                System.out.println("Server Says : "+str2);
                                                str2 = br.readLine();
                                                dout.writeUTF(str2);
                                                dout.flush();
                                                ps.println(ia);
                                                ps.close();
                                                dout.close();
                                                din.close();
                                               
                                               
                                }
                                catch(IOException e)
                                {
                                                System.out.println("The Exception is : "+e);
                                }
                }
}
//Output is :
//Server Computer
A:\Pravesh Tutorials\V3Mobile_For_Internshps>java tcpdateserver
Client Says :
PressvCtrl+c to quit
Client System/Ip address is : 127.0.0.1:3300/test?value=p .
//Cliect Computer
A:\Pravesh Tutorials\V3Mobile_For_Internshps>java tcpdateclient
The date/time on server is : Mon Mar 12 18:04:46 IST 2018
Server Says :

The response is I received p.


7. Write a program that take input from command line and print all the received input.
a. For example the java program name is X then the user will run the program as
i. Java X A B C
ii. The output is à There are 3 input, and inputs are A, B and C.
Solution:-
public class X {
    public static void main (String[] args) {
                                System.out.print("The output is -> There are 3 input, and inputs are "+args[0]+","+args[1]+" and "+args[2]);
                }
}

//If We enter java X A B then it gives Exception ArrayIndexOutOfBoundsException
A:\Pravesh Tutorials\V3Mobile_For_Internshps>java X A B
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2
        at X.main(X.java:3)


8. Write a SQL query to find the age is less than 30 and name start with S
a. Schema : Table name : test, Column (age, int (10), name varchar (10))

Solution:-
Select Column from test where age<30 and name LIKE '[S]%';
//Also use Like
Select Column from test where age<30 and name LIKE('%S');

9 What do you mean by platform independence?
Platform independence means that we can write and compile the java
code in one platform (eg Windows) and can execute the class in any other

supported platform eg (Linux,Solaris,etc).

10. Is Java a pure object oriented language?
Java uses primitive data types and hence is not a pure object-oriented

language.


Signature

Signature
Hello