Posts

DP

 fibaonaci series using dp class Solution { public int usingDp ( int n , int dp []) { if (n <= 1 ) return n ; if (dp[n] != - 1 ) return dp[n]; return dp[n] = usingDp (n - 1 ,dp) + usingDp (n - 2 ,dp); } public int fib ( int n ) { int [] dp = {n + 1 , - 1 }; int no = usingDp (n, dp); return no; } } TC = o(n) linear SC = o(n)+o(n) {array, stack space for recur}

something

 Wissen only ---------------- "1.reverse the string code import java.util.*; import java.lang.*; class  main{      public static String reverseString(String str) {   String s[] = str.split(" ");   StringBuilder reverse = new StringBuilder();   int n = s.length;   for(int i=n-1;i>=0;i-- )   {     reverse.append(s[i]).append(" ");   }   return reverse.toString();    } public static void main (String[] args) {       Scanner sc = new Scanner(System.in);   String input = sc.nextLine();   System.out.println(reverseString(input));     } } 2.spring boot working 3.create db for user and group and perform different operations using joins CREATE TABLE Users (     UserID INT PRIMARY KEY,     UserName VARCHAR(50),     GroupID INT,     FOREIGN KEY (GroupID) REFERENCES Groups(GroupID) ); -- Create table for groups CREATE TABLE Groups (   ...

google codes only

 1 two sum class Solution {     public int [] twoSum ( int [] nums , int target ) {         int n = nums . length ;         /*         HashMap<Integer,Integer> mpp = new HashMap();         for(int i=0;i<n;i++)           mpp.put(nums[i],i);         int [] ans = {-1,-1};         int low =0;         int high = n-1;          Arrays.sort(nums);         while(low < high)         {             int sum = nums[low] + nums[high];             if(sum==target)             {                 ans[0] = mpp.get(nums[low]);                 ans[1] = mpp.get(nums[high]);   ...

Nice Interview questions

Duration: 1hr 15 min Explain Encapsulation and abstraction How can you achieve abstraction What is constructor in Java?explain the types of constructor Can we make Constructor as private? What is singleton class? Write java code for it What is static block? Explain JDK, JRE and JVM in detail What is class loader? Explain polymorphism  What is method hiding? how can you achieve it What is interface? where you use it Explain different type of access specifiers in java Write Program to print Fibonacci series Write program to find maximum element in an array Write SQl query to find 5th maximum marks from student table WHat is deep shadow and copy shadow  in java. Explain it with a writing program. How you inject dependency in springboot How Can you change JAVA version  Where you add configuration setting in spring boot project Explain pom.xml file. and what it contains What is association Explain Java 8 features What is stream API? how you use it Explain solid principles Expa...