1) Reverse a String = https://bit.
ly/3Qa34bn
String str="Sridhar"
String b="";
char ch;
for(int i=0;i<str.length();i++)
{
ch=str.CharAt(i)
b=ch+b;
}
Sysout("the reverse string is:" +b);
}
}
2) Generate Fibonacci series = https://bit.ly/3Z7k5Y7
int a=0;
int b=1;
for(int i=0;i<=10;i++) {
int c=a+b;
a=b;
b=c;
System.out.println(a);
3) Find largest and smallest in an array = https://bit.ly/3Z1TnA3
int[]ar= {2,34,21,32,67,45,3334,8};
int max=ar[0];
int min=ar[0];
for(int i=0;i<ar.length;i++) {
if(ar[i]>max) {
max=ar[i];
}
if(ar[i]>min) {
min=ar[i];
}
}
System.out.println("max is: "+max);
System.out.println("min is: "+min);
4) Search element in an array = https://bit.ly/3G8LrnS
5) Sort elements in an array = https://bit.ly/3i8b6VS
6) How to remove unwanted characters from string = https://bit.ly/3Icqs6m
7) How to reverse each word = https://bit.ly/3WD4y0w
8) Find given substring is presence = https://bit.ly/3G6w5jT
9) How to find duplicates = https://bit.ly/3i5usuD
int[] arr = {1, 2, 5, 5, 6, 6, 7, 2};
for (int i = 0; i < arr.length; i++)
{
for (int j = i; j < arr.length; j++)
{
if ((arr[i] == arr[j]) && (i != j))
{
System.out.println("Duplicate Elements : " + arr[j]);
}
}
}
10) Static keyword questions = https://bit.ly/3Z5kVEz
11) find the DuplicateCharacters in a given string
String str="Sridharerra";
Map<Character,Interger> charCountMap=new HashMap<>();
for(char ch:str.toCharArray())
{
if(charCountMap.Contatinskey(ch));
{
charCountMap.put(ch,charCountMap.get(ch)+1);
}
else
{
charCountMap.put(ch,1);
}
}
Sysout(charCountMap);
https://www.youtube.com/playlist?
list=PLqdHI1COI61OA6skF0cJ2H1TF7CbTw9oz=================