import java.io.*;
import java.util.Scanner;
public class NumerSmallerThanCurrentNumber {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the size of array : ");
int n = scanner.nextInt();
//Declaring the array
int arr[] = new int[n];
System.out.println("Enter the array elements : ");
for(int i=0;i<n;i++) {
arr[i] = scanner.nextInt();
}
System.out.println("The Entered elements are : ");
for(int i=0;i<n;i++) {
System.out.print(arr[i] + " ");
}
int listOfElements[] = countSmallerNumber(arr);
System.out.println("\nThe list of numbers smaller than current number : ");
for(int i=0;i<listOfElements.length;i++) {
System.out.print(listOfElements[i]+" ");
}
}
//Function for count the smaller element than the current element
private static int[] countSmallerNumber(int[] arr) {
//Take a array for storing the the count of smaller element than the current element
int countNumber[] = new int[arr.length];
for(int i=0;i<arr.length;i++) {
int count=0;
for(int j=0;j<arr.length;j++) {
//Compare current elements with other elements
if((arr[i]>arr[j]) && (i!=j)) {
//Increase the count, if other element is smaller than the current element
count++;
}
}
countNumber[i]=count;
}
return countNumber;
}
}
import java.util.Scanner;
public class NumerSmallerThanCurrentNumber {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the size of array : ");
int n = scanner.nextInt();
//Declaring the array
int arr[] = new int[n];
System.out.println("Enter the array elements : ");
for(int i=0;i<n;i++) {
arr[i] = scanner.nextInt();
}
System.out.println("The Entered elements are : ");
for(int i=0;i<n;i++) {
System.out.print(arr[i] + " ");
}
int listOfElements[] = countSmallerNumber(arr);
System.out.println("\nThe list of numbers smaller than current number : ");
for(int i=0;i<listOfElements.length;i++) {
System.out.print(listOfElements[i]+" ");
}
}
//Function for count the smaller element than the current element
private static int[] countSmallerNumber(int[] arr) {
//Take a array for storing the the count of smaller element than the current element
int countNumber[] = new int[arr.length];
for(int i=0;i<arr.length;i++) {
int count=0;
for(int j=0;j<arr.length;j++) {
//Compare current elements with other elements
if((arr[i]>arr[j]) && (i!=j)) {
//Increase the count, if other element is smaller than the current element
count++;
}
}
countNumber[i]=count;
}
return countNumber;
}
}
Cadence is Hiring Software Engineer Intern
Role : SDE intern
Experience: Student
Batch - 2022 /2023 /2024
Qualification - pursuing or completed B.E/B.Tech/M.E/M.Tech
Location: Remote ( Work from home)
Salary: 40k - 45k per month
Duration: 11 month
Apply now: https://www.linkedin.com/jobs/view/3274286602
Role : SDE intern
Experience: Student
Batch - 2022 /2023 /2024
Qualification - pursuing or completed B.E/B.Tech/M.E/M.Tech
Location: Remote ( Work from home)
Salary: 40k - 45k per month
Duration: 11 month
Apply now: https://www.linkedin.com/jobs/view/3274286602
Linkedin
Cadence Design Systems hiring Intern-Software Engineer in Ahmedabad, Gujarat, India | LinkedIn
Posted 9:58:31 AM. At Cadence, we hire and develop leaders and innovators who want to make an impact on the world ofโฆSee this and similar jobs on LinkedIn.
Java Hyd Team
import java.io.*; import java.util.Scanner; public class NumerSmallerThanCurrentNumber { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Enter the size of array : "); int n = scanner.nextInt();โฆ
HashMap<Integer,Integer> m= new HashMap<>();
int[] nums1= nums.clone();
Arrays.sort(nums);
int[] result= new int[nums.length];
for(int i=0;i<nums.length;i++){
if(!m.containsKey(nums[i])){
m.put(nums[i],m.getOrDefault(nums[i],i));
}
}
for(int j=0;j<nums.length;j++){
result[j]=m.get(nums1[j]);
}
return result;
}
int[] nums1= nums.clone();
Arrays.sort(nums);
int[] result= new int[nums.length];
for(int i=0;i<nums.length;i++){
if(!m.containsKey(nums[i])){
m.put(nums[i],m.getOrDefault(nums[i],i));
}
}
for(int j=0;j<nums.length;j++){
result[j]=m.get(nums1[j]);
}
return result;
}
import java.util.*;
class HelloWorld {
public static void main(String[] args) {
List<Integer> inp = Arrays.asList(8, 1, 2, 2, 3);
List<Integer> al = Arrays.asList(8, 1, 2, 2, 3);
Collections.sort(al);
Map<Integer, Integer> o = new HashMap<>();
List<Integer> res = new ArrayList<>();
for(int i = 0; i < al.size(); i++){
if (i != 0 && al.get(i) == al.get(i-1)) {
o.put(al.get(i), i-1);
} else {
o.put(al.get(i), i);
}
}
for(int i = 0; i < inp.size(); i++) {
res.add(o.get(inp.get(i)));
}
System.out.println(res.toString());
}
}
class HelloWorld {
public static void main(String[] args) {
List<Integer> inp = Arrays.asList(8, 1, 2, 2, 3);
List<Integer> al = Arrays.asList(8, 1, 2, 2, 3);
Collections.sort(al);
Map<Integer, Integer> o = new HashMap<>();
List<Integer> res = new ArrayList<>();
for(int i = 0; i < al.size(); i++){
if (i != 0 && al.get(i) == al.get(i-1)) {
o.put(al.get(i), i-1);
} else {
o.put(al.get(i), i);
}
}
for(int i = 0; i < inp.size(); i++) {
res.add(o.get(inp.get(i)));
}
System.out.println(res.toString());
}
}
// Online Java Compiler
// Use this editor to write, compile and run your Java code online
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.stream.Collectors;
class HelloWorld {
public static void main(String[] args) {
//List<Integer> al = Arrays.asList(8, 1, 2, 2, 3);
int[] l = new int[5];
int[] o = new int[5];
l[0] = 8;
l[1] = 1;
l[2] = 2;
l[3] = 2;
l[4] = 3;
for(int i = 0;i<l.length;i++){
int count = 0;
for(int j = 0; j < l.length; j++){
if(l[i] > l[j]){
count++;
}
}
o[i] = count;
}
ArrayList<Integer> integerArray = (ArrayList<Integer>) Arrays.stream(o).boxed().collect(Collectors.toList());
System.out.println(integerArray.toString());
for(int i = 0;i<l.length;i++){
System.out.println(o[i]);
}
}
}
// Use this editor to write, compile and run your Java code online
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.stream.Collectors;
class HelloWorld {
public static void main(String[] args) {
//List<Integer> al = Arrays.asList(8, 1, 2, 2, 3);
int[] l = new int[5];
int[] o = new int[5];
l[0] = 8;
l[1] = 1;
l[2] = 2;
l[3] = 2;
l[4] = 3;
for(int i = 0;i<l.length;i++){
int count = 0;
for(int j = 0; j < l.length; j++){
if(l[i] > l[j]){
count++;
}
}
o[i] = count;
}
ArrayList<Integer> integerArray = (ArrayList<Integer>) Arrays.stream(o).boxed().collect(Collectors.toList());
System.out.println(integerArray.toString());
for(int i = 0;i<l.length;i++){
System.out.println(o[i]);
}
}
}
// Online Java Compiler
// Use this editor to write, compile and run your Java code online
import java.util.*;
class HelloWorld {
public static void main(String[] args) {
List<Integer> i1 = Arrays.asList(2, 4, 3);
List<Integer> i2 = Arrays.asList(5, 6, 4);
List<Integer> o = new ArrayList<>();
int d = 0;
for(int i = 0; i < i1.size(); i++){
int x = i1.get(i) + i2.get(i);
if (x > 9) {
d = x/10;
int r = x%10;
x = d>0 ? r : x;
} else {
x = d>0 ? (x + d) : x;
}
o.add(x);
}
System.out.println(o.toString());
}
}
// Use this editor to write, compile and run your Java code online
import java.util.*;
class HelloWorld {
public static void main(String[] args) {
List<Integer> i1 = Arrays.asList(2, 4, 3);
List<Integer> i2 = Arrays.asList(5, 6, 4);
List<Integer> o = new ArrayList<>();
int d = 0;
for(int i = 0; i < i1.size(); i++){
int x = i1.get(i) + i2.get(i);
if (x > 9) {
d = x/10;
int r = x%10;
x = d>0 ? r : x;
} else {
x = d>0 ? (x + d) : x;
}
o.add(x);
}
System.out.println(o.toString());
}
}
Which topic you want to learn from scratch
Anonymous Poll
56%
Array
49%
Collection
44%
Multi threading
42%
Exception handling
40%
Strings
28%
Interfaces n abstract methods
40%
Java 8
๐ฅ1
DO VOTE WE WILL COVER EVERYTHING EVERY THIRD DAY OF THE WEEK SUNDAY WE WILL ARRANGE TESTS SO THAT YOU CAN GET MORE CLARITY
๐3
Java Hyd Team
Which topic you want to learn from scratch
Out of 68 people only 9 people are having issues in Java these 9 people can ping @stockkida will start from Wednesday till Monday please update with the topics whichever you want to learn will cover the best solution with good techniques
Java Hyd Team
JAVASCRIPT NOTES FOR BEGINNERS.pdf
Complete these ๐๐ use MS office to open these PDFs for better experience
๐2
JAVA BOOST.pdf
874.3 KB
1. Object Oriented Programming (OOP)
2. General Questions about Java
3. Java Threads
4. Java Collections
5. Garbage Collectors
6. Exception Handling
7. Java Applets
8. Swing
9. JDBC
10. Remote Method Invocation (RMI)
11. Servlets
12. JSP
I found it really amazing and useful for Java interview preparation, so sharing with you all.
Thanks to Stathis Maneas for this wonderful and concise doc.
Save it for the future reference and share it with the needy ones.
2. General Questions about Java
3. Java Threads
4. Java Collections
5. Garbage Collectors
6. Exception Handling
7. Java Applets
8. Swing
9. JDBC
10. Remote Method Invocation (RMI)
11. Servlets
12. JSP
I found it really amazing and useful for Java interview preparation, so sharing with you all.
Thanks to Stathis Maneas for this wonderful and concise doc.
Save it for the future reference and share it with the needy ones.