Sunday, 4 August 2019

Find whether there is path between two cells in matrix


Solution:-

import java.util.*;
class Point
{
    int x,y;
    Point(int x,int y)
    {
        this.x=x;
        this.y=y;
    }
}
class Queue
{
    Point p[]=new Point[10000];
    int front=-1,end=-1;
    void add(int x,int y)
    {
        if(front==-1)
            front=0;
        if(end<9999)
        {
            p[++end]=new Point(x,y);
        }
    }
    Point poll()
    {
        Point x=p[front++];
        return x;
    }
    boolean isEmpty()
    {
        if(front>end)
          return true;
        if(front==-1||end==-1)
          return true;
      return false;     
    }
}

class GFG {
    static String check(int mat[][],int n,int m)
    {
        boolean visited[][]=new boolean[n][m];
        Point p=new Point(0,0);
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<m;j++)
            {
                if(mat[i][j]==1)
                {
                    p.x=i;
                    p.y=j;
                }
                else if(mat[i][j]==0)
                 visited[i][j]=true;
                 else
                 visited[i][j]=false;
            }
        }
        Queue q=new Queue();
        q.add(p.x,p.y);
        visited[p.x][p.y]=true;
        while(!q.isEmpty())
        {
            p=q.poll();
            if(mat[p.x][p.y]==2)
             return "YES";
             //left
            if(p.y-1>=0&&visited[p.x][p.y-1]==false)
            {
                q.add(p.x,p.y-1);
                visited[p.x][p.y-1]=true;
            }
            //right
             if(p.y+1<m&&visited[p.x][p.y+1]==false)
            {
                q.add(p.x,p.y+1);
                visited[p.x][p.y+1]=true;
            }
            //bottom
             if(p.x+1<n&&visited[p.x+1][p.y]==false)
            {
                q.add(p.x+1,p.y);
                visited[p.x+1][p.y]=true;
            }
            //top
             if(p.x-1>=0&&visited[p.x-1][p.y]==false)
            {
                q.add(p.x-1,p.y);
                visited[p.x-1][p.y]=true;
            }
        }
        return "NO";
    }
public static void main (String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int m=sc.nextInt();
int mat[][]=new int[n][m];
for(int i=0;i<n;i++)
{
    for(int j=0;j<m;j++)
    {
        mat[i][j]=sc.nextInt();
    }
}
System.out.println(check(mat,n,m));
}
}




Friday, 19 July 2019

Mobikwik Interview Experience |( OffCampus Drive Quality Assurance SDET-I)

MobiKwik is an Indian company founded in 2009 that provides a mobile phone based payment system and digital wallet. Customers add money to an online wallet that can be used for payments.

A couple of days back(22nd July,2019) MobiKwik hire as Quality Assurance Engineer SDET-I for passout 2019 batch.
Selection process go thru various round let's discuss about that.

Round 1:- Offline Wriiten Coding and MCQ and Test Cases   

This round was 40 minuts and contains 15 MCQ which was technical,aptitude ,Data Structure and 2 Coding Questions,and 1 Test Case writting.

Coding 1:-  Given a string find all permutaions of given string in lexicographical order.

Coding 2:-  Given an array remove duplicate elements from the array.

ex:-  a[]={1,2 3,1,2,3,1,2}

Output:-   {1,2,3,0,0,0,0,0}

Round 2:-  Technical Interview-I

After written test almost 34 students got selected for next round and I was one of them.
In this round Interviewer came and ask me tell me something about yourself. I was very nervous but interviewer was very cool and after introduction he asked me 3 coding problem.
 1. Given an array sort array using recursion.
 2. Given string print all the string that accure more than one times in the given string.
     ex:  my name is sushil mall my name is.

     Output:-   my name is
 3. Find Second highest element in the array.

after asking coding he asked me some puzzles, databases queries and testing related questions.

Round 3:- Technical Interview-II

I was very happy to clear the first round and in the second round interviewer came and asked me tell me something about yourself. she was very cool and very friendy.
she asked me a coding question and write code about the given question. queastion was given a array find second minimum element in the gievn array.after that she asked me puzzles and queries.

Round 3:- Testing interviews-III

Again i was very happy because I have clear the second technical round and on left testing and was last round.Interviewer came and asked me why should we hire you convince me.I explain but he was not convinced. I was very nervous because he was not friendy and his attitude was very dangrous.then after discussion at leas 10 minut on why should we hire you. he said me to write test case of wallet transaction. again I was fear and nervous because he was not friendly and everyone knows that 'fear is not good for fair' I write some test cases he said think something and write some another test cases. and then he asked me to write Test cases of shoes I write but he gave me time limit and said to write 50 test cases. Finaly result announce and I was not selected only 4 student got selected.But when I was going to my house HR call me and said that come tomarrow with some preperation about testing.

 Round 4:- Technical Interview-IV

Next day I went again Mobikwik office for last interview. Then inetrviewer came and asked my why you did not select previuos day. I explain all about previous day then he gave me a coding problem to solve and write the code. problem was given a 2-D n*n matrix rotate it 90 degree. I wrote code firstly and explain him. He said write test case of every steps of given problem I wrote he was very happy. he asked me to write test case of lift I wrote and tell him but he want to know more test cases. then he asked me how much companies you have already give Interviews then last hes asked me a puzlle and said if you will solve this puzzle then you will got selected today otherwise some difficulties will got. and you have infinite time and you can try many time. I solve that with in 10 min with 5th tery he becomy happy and handshake with me congratulate me. then HR came and asked about my family and said congratulation and we are going to hire you said your family.
I was very happy to get a offer from Mobikwik. Thanks a lot Mobikwik and their Team.

*******************************Enjoy ********************************************

Monday, 6 May 2019

Best Data Science and Big Data Analytic LinkedIn Group You should Join them

We are familiar with linkedin which is social networking site where many people are connected to each other and share their experience and opportunity to other. These all people are professional, experienced,expert in their era,Employee of the best companies.



1. Big Data and Analytics

Members: 354,502

Founded in 2012 by Rob Howes, Linkedin Group: Big Data and Analytics has grown to be the largest and most active group of it's kind. With over 300,000 members, it has become the go-to community for all things data. You will find a wide range of topics including AI, Machine learning, Blockchain, etc. This group is moderated and managed by Sarah Howes. Contact :Sarah@howesmedia.com

2. Big Data, Analytics, Business Intelligence & Visualization Experts Community

Members: 252,466

A premier community for both existing expert professionals and companies researching the convergence of big data analytics and discovery, Hadoop, data warehousing, cloud, unified data architectures, digital marketing, visualization and business intelligence.

3. Business Intelligence Professionals (BI, Big Data, Analytics)

Members: 231,388

This group covers the broad area of data analytics & intelligence for businesses. Tools, frameworks, white papers, industry news & best practices! PLEASE READ THE GROUP RULES before participating! Visit Aigents.co to discover career opportunities for Data-, AI- & Machine Learning Engineers.

4. Data Mining, Statistics, Big Data, Data Visualization, and Data Science

Members: 181,538

This is a group for data mining and statistical professionals who wish to expand our network of people and share ideas. Methodological issues are fair game, as well as discussion of software (SAS, R, WEKA, etc), technology (Hadoop, relational databases, etc) conferences, and job postings. Please note that job postings should only be submitted in the Jobs space, while advertising of services should only be submitted.

5. Big Data, Analytics, IoT (Internet of Things) & Blockchain

Members: 75,012

The group promotes discussion around Big Data, NoSql and Cloud Computing. Like Big Data Analytics, BI, SAS, Big Data Hadoop, Big Data MapReduce, YARN, PIG, Hive, HQL, Oozie, Sqoop, Flume, Kafka, Spark, Big Data NoSQL, HBase, Casandra, MongoDB,

6. IBM Big Data and Analytics

Members: 47,702

Everyday, we create 2.5 Quintilion bytes of data–so much that 90% of the data in the world today has been created in the last two years alone. This data comes from everywhere: from sensors used to gather climate information, posts to social media sites, digital pictures and videos posted online, transaction records of online purchases, and from cell phone GPS signals to name a few. This data is big data.

 7. Advanced Analytics and Data Science

Members: 12,054

Our mission is to provide a resource for people who want to learn about and use advanced analytics and data science capabilities. Meet other people involved with predictive analytics, statistics, machine learning, decision optimization, real-time analytics and big data to have discussions and make connections. Whether you are a data professional who wants to extract meaning from and interpret data, or an expert analyst responsible for making decisions in areas such as marketing, operations, finance, HR or sales, this is the place for you.


Wednesday, 17 April 2019

Which Programming Language is best for Competitive Coding

As we know competitive programming is best for learn a lot of thing related to code and every time  we learn a new problem in the Competitive Programming. A lot of languages available with us like C,C++,java,Python,C#,Perl,PHP,Scala etc but we need to choose best of these which would be suitable for us to write the code easily and that take less time to execute.So let's learn which one is best for the Competitive Programminng.

1:-The best programming language for competitive Coding is C++ because it is object oriented and take less time to execute it's code and extra STL(Standard Template Library) available in C++ which help to reduce the line of code and make language easy to code.The Standard Template Library (STL) is a set of C++ template classes to provide common programming data structures and functions such as lists, stacks, arrays, etc. It is a library of container classes, algorithms, and iterators. It is a generalized library and so, its components are parameterized. A working knowledge of template classes is a prerequisite for working with STL. 

          "So C++ is best for Competitive Coding every Coding lover should learn it".

2:- Java is also best for competitive programming because it is Object Oriented and provide Collections to write the code.But it is lesser than C++. But it is better to learn and easily to write the code.

         "So Java is best for Competitive Coding every Coding lover should learn it".  

Algorithm is also put's matter on writing your code. Both java and C++ are better for competitive programming. Everyone whole write the code in C or C# please switch either C++ or Java because it is best for competitive coding.
Python is also better but Python is more efficient for development,Machine Learning and Artificial Intelligence.
So it's your choice which language you are suitable to learn but again C++ and Java is best for Competitive Coding.    

Saturday, 30 March 2019

My Pathshala Interview Experiences

My Pathshala is a startup that provide a platform for education and preparation of various exam like SSC, Bank, UPSC etc.
Today My Pathshala visit in our Campus for recruit as php web developer They conduct following processes.

1)Written Test:- In this Round there are four section Aptitude,Reasoning,English and Technical
They give more preference to technical portion I cleared easly this round.

2)HR Round:- Second Round was HR Round in this round they asked simply question that are based on resume and some general question based on Behavior I have cleared this round.

3)Technical interview :- This round was last round and based on technical questions Firstly Interviewer asked how you solve technical portion of the written test I explain.
 Then he asked me which programming language which have more strength I said Java.Then he asked me questions on Java.Questions was...

a)What is anonymous class in Java?

b)What is Map?

c)A coding question Question was Given List of name and id of Employee how you will sort it using Id.

I did not give the answer of first question rest question I gave the answer but I was rejected.
Finally my three friends are selected.(30 March,2019).


 

Monday, 25 February 2019

Google Kick-Start 2019 Practice Round Problem 2 with solution

Problem 2 Mural(15pts,23pts)

Thanh wants to paint a wonderful mural on a wall that is N sections long. Each section of the wall has a beauty score, which indicates how beautiful it will look if it is painted. Unfortunately, the wall is starting to crumble due to a recent flood, so he will need to work fast!
At the beginning of each day, Thanh will paint one of the sections of the wall. On the first day, he is free to paint any section he likes. On each subsequent day, he must paint a new section that is next to a section he has already painted, since he does not want to split up the mural.
At the end of each day, one section of the wall will be destroyed. It is always a section of wall that is adjacent to only one other section and is unpainted (Thanh is using a waterproof paint, so painted sections can't be destroyed).
The total beauty of Thanh's mural will be equal to the sum of the beauty scores of the sections he has painted. Thanh would like to guarantee that, no matter how the wall is destroyed, he can still achieve a total beauty of at least B. What's the maximum value of B for which he can make this guarantee?

Input

The first line of the input gives the number of test cases, TT test cases follow. Each test case starts with a line containing an integer N. Then, another line follows containing a string of N digits from 0 to 9. The i-th digit represents the beauty score of the i-th section of the wall.

Output

For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the maximum beauty score that Thanh can guarantee that he can achieve, as described above.

Limits

1 ≤ T ≤ 100.
Time limit: 20 seconds per test set.
Memory limit: 1 GB.

Small dataset (Test set 1 - Visible)

2 ≤ N ≤ 100.

Large dataset (Test set 2 - Hidden)

For exactly 1 case, N = 5 × 106; for the other T - 1 cases, 2 ≤ N ≤ 100.

Sample


Input

Output
4
4
1332
4
9583
3
616
10
1029384756

  
Case #1: 6
Case #2: 14
Case #3: 7
Case #4: 31

  
In the first sample case, Thanh can get a total beauty of 6, no matter how the wall is destroyed. On the first day, he can paint either section of wall with beauty score 3. At the end of the day, either the 1st section or the 4th section will be destroyed, but it does not matter which one. On the second day, he can paint the other section with beauty score 3.
In the second sample case, Thanh can get a total beauty of 14, by painting the leftmost section of wall (with beauty score 9). The only section of wall that can be destroyed is the rightmost one, since the leftmost one is painted. On the second day, he can paint the second leftmost section with beauty score 5. Then the last unpainted section of wall on the right is destroyed. Note that on the second day, Thanh cannot choose to paint the third section of wall (with beauty score 8), since it is not adjacent to any other painted sections.
In the third sample case, Thanh can get a total beauty of 7. He begins by painting the section in the middle (with beauty score 1). Whichever section is destroyed at the end of the day, he can paint the remaining wall at the start of the second day.


[Solution in Java]
import java.util.*;
import java.io.*;
class Solution {
    static long getValue(String s,int n)
    {
        int k=0;
        long sum=0;
        if(n%2==0)
          k=n/2;
        else
         k=n/2+1;
         for(int i=0;i<k;i++)
         {
             sum+=Integer.parseInt(Character.toString(s.charAt(i)));
         }
      long curr_sum = sum;
        for (int i=k; i<n; i++)
        {
           curr_sum += Integer.parseInt(Character.toString(s.charAt(i))) -Integer.parseInt(Character.toString(s.charAt(i-k)));
           sum = Math.max(sum, curr_sum);
        }
      
        return sum;
       
    }
  public static void main(String[] args) {
    Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
    int t = in.nextInt(); 
    for (int i = 1; i <= t; ++i) {
      int n = in.nextInt();
      String s=in.next();
      long x=getValue(s,n);
      System.out.println("Case #" + i + ": " + x);
    }
  }
}


Thursday, 14 February 2019

Check a triplet that sum is given value

Given an array A[] of N numbers and another number x, determine whether or not there exist three elements in A[] whose sum is exactly x.
Input:
First line of input contains number of testcases T. For each testcase, first line of input contains n and x. Next line contains array elements.
Output:
Print 1 if there exist three elements in A whose sum is exactly x, else 0.
Constraints:
1 ≤ T ≤ 100
1 ≤ N ≤ 103
1 ≤ A[i] ≤ 105
Example:
Input:
2
6 13
1 4 45 6 10 8
5 10
1 2 4 3 6
Output:
1
1
Explanation:
Testcase 1:
 There is one triplet with sum 13 in the array. Triplet elements are 1, 4, 8, whose sum is 13.


Solution 1:(Brute-Force or Simple Method) in O(n^3)

import java.lang.*;
import java.io.*;
class Sushil
 {
     static int getCount(int a[],int x)
     {
         Arrays.sort(a);
         int n=a.length;
         for(int i=0;i<n;i++)
         {
             for(int j=i+1;j<n;j++)
             {
                 for(int k=j+1;k<n;k++)
                 {
                     if((a[i]+a[j]+a[k])==x)
                         return 1;
                 }
             }
         }
               return 0;
     }
    public static void main (String[] args)
     {
         Scanner sc=new Scanner(System.in);
         int t=sc.nextInt();
         while(t-->0)
         {
             int n=sc.nextInt();
             int x=sc.nextInt();
             int a[]=new int[n];
             for(int i=0;i<n;i++)
               a[i]=sc.nextInt();
           System.out.println(getCount(a,x));   
         }
        
   
     }
}


Solution 2:(Sorting Technique) in O(n^2)

 import java.lang.*;
import java.io.*;
class Sushil
 {
     static int getCount(int a[],int x)
     {
       
         Arrays.sort(a);
         int n=a.length;
         for(int i=0;i<n-2;i++)
         {
             int l=i+1;
             int r=n-1;
             while(l<r)
             {
                 if(a[i]+a[l]+a[r]==x)
                   return 1;
                 if(a[i]+a[l]+a[r]<x)
                    l++;
                  else
                   r--;
             }
         }
         return 0;
     }
    public static void main (String[] args)
     {
         Scanner sc=new Scanner(System.in);
         int t=sc.nextInt();
         while(t-->0)
         {
             int n=sc.nextInt();
             int x=sc.nextInt();
             int a[]=new int[n];
             for(int i=0;i<n;i++)
               a[i]=sc.nextInt();
           System.out.println(getCount(a,x));  
         }
       
    
     }
}