package [Link].
cases;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class TempPrograms {
// Top 22 Java Interview Programs
// Author - Amol Koshti [whatsapp 9762542122]
public static void main(String[] args) {
//-------------- 01 - Check if number is palindrome
----------------------------------
// String s1 = "madam";
// StringBuilder sb = new StringBuilder(s1);
// StringBuilder temp = [Link]();
// String s2 = [Link]();
// if([Link](s2))
// [Link]("String is palindrome");
// else
// [Link]("String is NOT palindrome");
//-------------- 02 - Reverse a number
-----------------------------------------------
// int n =12345, rev=0;
// while(n!=0){
// int r = n%10;
// n = n/10;
// rev = rev*10+r;
// }
// [Link]("Reversed = "+rev);
//-------------- 03 - Reverse string by Words
----------------------------------------
// String s = "life is beautiful enjoy it";
// String[] parts = [Link](" ");
// for(int i=[Link]-1;i>=0;i--)
// [Link](parts[i]+" ");
//-------------- 04 - Reverse string by character
------------------------------------
// String s = "life is beautiful enjoy it";
// for(int i=[Link]()-1;i>=0;i--)
// [Link]([Link](i));
//-------------- 05 - Convert First Character of String to UpperCase
-----------------
// String s = "life is beautiful enjoy it";
// String[] parts = [Link](" ");
// for(int i=0;i<[Link];i++){
// char[] ch = parts[i].toCharArray();
// for(int j=0;j<[Link];j++){
// ch[0] = [Link](ch[0]);
// [Link](ch[j]);
// }
// [Link](" ");
// }
//-------------- 06 - Count of Characters in String
(Incomplete)-----------------------
// Create an array of size 256 i.e. ASCII_SIZE
// String s = "abbcccdddd";
// char[] ch = [Link]();
//
// for(int i=0;i<[Link];i++){
// int counter=0;
// char c=[Link](i);
// for(int j=0;j<[Link]();j++){
// if(c==ch[j]){
// counter++;
//// ch[j] = '\u0000'; // OR ch[j] = 0;
// }
// }
// if(counter>0)
// [Link](c+" "+counter);
// }
//-------------- 07 - Swap two numbers without using 3rd
------------------------------
// int a=100, b=300;
// a=a+b;
// b=a-b;
// a=a-b;
// [Link]("a="+a);
// [Link]("b="+b);
//-------------- 08 - Sort Integer Array in ASC/DSC
-----------------------------------
// int[] a = new int[]{5,4,1,2,3};
// int temp = 0;
// for(int i=0;i<[Link];i++){
// for(int j=i+1;j<[Link];j++){
// if(a[i]>a[j]){
// temp = a[i];
// a[i] = a[j];
// a[j] = temp;
// }
// }
// }
// for(int i=0;i<[Link];i++)
// [Link](a[i]+" ");
//-------------- 09 - Program to Generate random number
-------------------------------
// Random r = new Random();
// int n = [Link]();
// [Link](n);
//-------------- 10 - Check Number of Vowels in String
-------------------------------
// String s = "life is beautiful enjoy it";
// char[] letters = [Link]();
// int count = 0;
// for(char c : letters){
// switch(c){
// case 'a' :
// case 'e' :
// case 'i' :
// case 'o' :
// case 'u' :
// count++;
// break;
// default:
// }
// }
// [Link]("Total Vowels in String = "+count);
//-------------- 11 - First Non-Repeated Character in String
--------------------------
// String s = "aabbbcdddd";
// char ch[] = [Link]();
// for(char c : ch){
// if([Link](c)==[Link](c)){
// [Link]("First non-repeat char = "+c);
// break;
// }
// }
//-------------- 12 - Find If String is Palindrome
-----------------------------------
// String s1 = "madam";
// StringBuilder sb = new StringBuilder(s1);
// StringBuilder temp = [Link]();
// String s2 = [Link]();
// if([Link](s2))
// [Link]("String is Palindrome");
// else
// [Link]("String is NOT Palindrome");
//-------------- 13 - Find 1st & 2nd Greater Number from Array
-----------------------
// int[] a = {1,2,3,4,5,6,7,8,9};
// int g1=0,g2=0;
// for(int i=0;i<[Link];i++){
// if(a[i]>g1){
// g2=g1;
// g1=a[i];
// }
// }
// [Link]("g1 = "+g1);
// [Link]("g2 = "+g2);
//-------------- 14 - Find Missing Number in Array
-----------------------------------
// int[] a = {4,5,6,7,9};
// [Link](a);
// for(int i=0;i<[Link];i++)
// [Link](a[i]+" ");
// [Link](" ");
// int first;
// first=a[0];
// [Link](first);
// for(int i=1;i<[Link];i++){
// if(a[i]==(first+1)){
// first=a[i];
// [Link](a[i]);
// }else{
// [Link]("missing = "+(first+1));
// break;
// }
// }
//-------------- 15 - Find Duplicate Number in Array
---------------------------------
// int[] a = {4,5,6,7,8,9,9};
// [Link](a);
// for(int i=0;i<[Link];i++){
// int n = a[i];
// int counter =0;
// for(int j=0;j<[Link];j++){
// if(n==a[j])
// counter++;
// }
// if(counter>1){
// [Link]("Duplicate Number = "+a[i]);
// break;
// }
// }
//-------------- 16 - Remove first repeated Number in Array
---------------------------
// int c =0;
// int[] a = {1,2,3,4,5,1};
// [Link](a);
// for(int i=0;i<[Link];i++){
// int n = a[i];
// int counter = 0;
// for(int j=0;j<[Link];j++){
// if(a[i]==a[j])
// counter++;
// }
// if(counter>1){
// [Link]("Repeated Number : "+n);
// c=n;
// break;
// }
// }
// a = [Link](a, c);
// for(int i=0;i<[Link];i++)
// [Link](a[i]+" ");
//-------------- 17 - Find first non-repeated Number in Array
------------------------
// int[] a = {4,9,4,8,7,8,9};
// [Link](a);
// for(int i=0;i<[Link];i++){
// int n = a[i];
// int counter =0;
// for(int j=0;j<[Link];j++){
// if(n==a[j])
// counter++;
// }
// if(counter==1){
// [Link]("Non-Repeat Number = "+a[i]);
// break;
// }
// }
//-------------- 18 - Find common element in 2 Array
----------------------------------
// int[] a = {1,2,3,4,5};
// [Link](a);
// int[] b = {6,7,2,9,1};
// [Link](b);
// for(int i=0;i<[Link];i++){
// for(int j=0;j<[Link];j++){
// if(a[i]==b[j])
// [Link]("Common Element : "+a[i]);
// }
// }
//-------------- 19 - Check if element of string is number
----------------------------
// String[] ss = {"abc","123","xyz"};
// Pattern pattern = [Link](".*[^0-9].*");
// for(int i=0;i<[Link];i++)
// [Link]("Input "+ss[i]+" is number :"+!
[Link](ss[i]).matches());
//-------------- 20 - Fibonacci Series
----------------------------------------------
// int prev,next,sum=0;
// prev=next=1;
// [Link](prev+" ");
// for(int i=1;i<10;i++){
// sum = prev + next;
// [Link](sum+" ");
// prev= next;
// next = sum;
// }
//-------------- 21 - Prime Number
---------------------------------------------------
// boolean flag = true;
// Scanner sc = new Scanner([Link]);
// [Link]("Enter number -> ");
// int n = [Link]();
// for(int i=2;i<n;i++){
// int rem = n%i;
// if(rem==0){
// flag = false;
// break;
// }
// }
// if(flag) [Link]("Prime");
// else [Link]("Not Prime");
// -------------- 22 - Factorial Number
----------------------------------------------
// int fact = 1;
// int n = 4;
// for(int i=1;i<=n;i++)
// fact=fact*i;
// [Link]("Factorial = "+fact);
}
}