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));  
         }
       
    
     }
}

Tuesday, 8 January 2019

5G Internet and Mean of 5G

Superfast "fifth generation 5G" mobile internet could be launched as early as next year in some countries, promising download speeds 10 to 20 times faster than we have now.
So let's learn and understand about the 5G Internet.

What is 5G?

It's the next - fifth-generation of mobile internet connectivity promising much faster data download and upload speeds, wider coverage and more stable connections.
5G performance targets high data rate, reduced latency, energy saving, cost reduction, higher system capacity, and massive device connectivity. The first phase of 5G specifications in Release-15 will be completed by April 2019 to accommodate the early commercial deployment. The second phase in Release-16 is due to be completed by April 2020 for submission to the International Telecommunication Union (ITU) as a candidate of IMT-2020 technology.

It's all about making better use of the radio spectrum and enabling far more devices to access the mobile internet at the same time.



What it will do for Us?

 Currently whatever we are doing to the current 4G network after launching the 5G network all these things can be faster and better.

Think of smart glasses featuring augmented reality, mobile virtual reality, much higher quality video, the internet of things making cities smarter. and all these things can be operates and mange by 5G network very efficiently and fast.





How Does it works? 

There are a number of new technologies likely to be applied - but standards haven't been hammered out yet for all 5G protocols. Higher-frequency bands - 3.5GHz (gigahertz) to 26GHz and beyond - have a lot of capacity but their shorter wavelengths mean their range is lower - they're more easily blocked by physical objects.

So we may see clusters of smaller phone masts closer to the ground transmitting so-called "millimetre waves" between much higher numbers of transmitters and receivers. This will enable higher density of usage. But it's expensive and telecoms companies are not wholly committed yet.


How it is different from 4G

5G will offer much higher bandwidth and capacity than 4G services. 5G not only unlocks more wireless frequencies to use between 5G NR (new radio) and mmWave (millimeter wave), it’s also designed to makes better use of what’s available between potentially many thousands of users in urban environments.

5G can offer a much lower latency than 4G. Ultra-low latency is desirable to consumers who expect a real-time response (video calling, streaming, etc), however 5G can even support some scenarios where an immediate response is not just preferred but mission critical: such as medical applications.

5G is a brand new technology, but you might not notice vastly higher speeds at first because 5G is likely to be used by network operators initially as a way to boost capacity on existing 4G (LTE - Long-Term Evolution) networks, to ensure a more consistent service for customers. The speed you get will depend on which spectrum band the operator runs the 5G technology on and how much your carrier has invested in new masts and transmitters.

Why we need 5G?

The world is going mobile and we're consuming more data every year, particularly as the popularity of video and music streaming increases. Existing spectrum bands are becoming congested, leading to breakdowns in service, particularly when lots of people in the same area are trying to access online mobile services at the same time. 5G is much better at handling thousands of devices simultaneously, from mobiles to equipment sensors, video cameras to smart street lights. 

Will it work in rural Areas?

Lack of signal and low data speeds in rural areas is a common complaint in the India and many other countries. But 5G won't necessarily address this issue as it will operate on high-frequency bands - to start with at least - that have a lot of capacity but cover shorter distances. 5G will primarily be an urban service for densely populated areas. 

Saturday, 5 January 2019

How to Hide Whats Profile Picture from Specific Contact


Facebook-Owned instant messaging platform WhatsApp is one of the most used instant messaging app.It's used by million of users around all over the world.In the last couple of months, we have seen several new feature added to the app such as two step verification, hiding status, hiding profile picture and more.
But there's one things that's missing that WhatsApp does not have direct option that gives the user customize profile picture privacy setting for specific contacts.Having said that sometimes we just want to hide our profile picture or status from only one contact or a number of people without completely blocking them.


Let's know how to hide profile picture from specific contact.

Pre-Requisite

Download and install the latest version(2.18) of WhatsApp  from your respective app store.

Working Internet Connection.



Steps 1:
  1. Open Contact App from Your Smart phone and search the contact you want to hide
  2.  Now Delete the Contact.
Step 2: 
  1. Open WhatsApp on your smartphone 
  2. Tap on three-dot from the top right corner
  3. Select 'Setting' and goto 'Account' option
  4. Now Click on 'Privacy'
  5. Tap on the option 'Profile Photo' and select the option 'My Contact'


Repeat the step1 and step2 to hide the other contacts.

Friday, 4 January 2019

Google Assistant (Google Home)

Google is one of the most popular technology company headquarter in Mountain View, California United State of America.Its provide internet services and product which include online advertising technologies, search engine, cloud computing, software and hardware.

Google Home

Google home is a smart speaker developed by Google. The first device is announced in May 2016 and release in the United States in November 2016, with subsequent release globally throughout 2017 and 2018.
It's great at answering questions, setting timers and playing music, but it's also really useful for  controlling your smart home devices, such as locks, light and more.


Google Home speakers enable users to speak voice commands to interact with services through Google's personal assistant software called Google Assistant. A large number of services, both in-house and third-party, are integrated, allowing users to listen to music, control playback of videos or photos, or receive news updates entirely by voice. Google Home devices also have integrated support for home automation, letting users control smart home appliances with their voice. Multiple Google Home devices can be placed in different rooms in a home for synchronized playback of music. An update in April 2017 brought multi-user support, allowing the device to distinguish between up to six people by voice. In May 2017, Google announced multiple updates to Google Home's functionality, including: free hands-free phone calling in the United States and Canada; proactive updates ahead of scheduled events; visual responses on mobile devices or Chromecast-enabled televisions; Bluetooth audio streaming; and the ability to add reminders and calendar appointments.

Manage Your Day

Get personalized help with your schedule, reminders, news and much more, whenever Google Home recognizes your voice.

                  "Hey Google, what is traffic like on my way to work? " 

    "Hey Google, When's my first event tomorrow?"

Entertainment Hands-Free

Google Home works with Chromecast, so you can stream shows, movies and music on your TV or speakers.


                                      "Hey Google, Play the Mission Impossible on Netflix"

        "Hey Google,Play the Yoga Video on my TV"