EduLearn - Online Education Platform

Welcome to EduLearn!

Start learning today with our wide range of courses taught by industry experts. Gain new skills, advance your career, or explore new interests.

Browse Courses

Java data structure practice programs for leetcode

Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.   Example 1: Input: haystack = “sadbutsad”, needle = “sad” Output: 0 Explanation: “sad” occurs at index 0 and 6. The first occurrence is at index 0, so we […]

Java practice programs in data structures

Given a non-empty array of integers nums[], every element appears twice except for one. Find that single one.   Input: nums = [2,2,1] Output: 1 Example 2: Input: nums = [4,1,2,1,2] Output: 4     ——————————— public class Main { public static int SingleNumber(int[] nums)//2,2,1 { int result = 0; for (int num : nums) […]

Java practice programs for leetcode

Given an integer array nums[], rotate the array to the right by k steps, where k is non-negative.   Example 1: Input: nums = [1,2,3,4,5,6,7], k = 3 Output: [5,6,7,1,2,3,4] Explanation: rotate 1 steps to the right: [7,1,2,3,4,5,6] rotate 2 steps to the right: [6,7,1,2,3,4,5] rotate 3 steps to the right: [5,6,7,1,2,3,4]   ————————————————– class […]

Java code to create rectangle with attributes

Create a class Rectangle with attributes length and width. Use a constructor to initialize values and calculate the area   class Rectangle { int length, width;   Rectangle(int l,int w) { length=l; width=w; }   int area() { return length*width; } } class Main { public static void main(String args[]) { Rectangle r=new Rectangle(10,2); System.out.println(“Area=” […]

Java code to find bank details

Create a class BankAccount with attributes account holder name,account number and balance. Include a methods for deposit and withdrawal   class BankAccount { String Holdername; int AccountNo; int Balance;   void deposit(int amount)amount=3000 { Balance+=amount;//8000 }   void withdrawal(int amount)//1000 { if(amount<=Balance)//1000<=8000 Balance-=amount;//7000 else System.out.println(Insufficient Balance”); }   void display() { System.out.println(Balance);//7000 }   } […]

Java code to find student data

Create a student class with attributes name, roll number and marks. create 2 student objects and display their details   class Student { String name; int rollNo; int marks;   void display() { System.out.println(“Name=” +name); System.out.println(“Roll no=” +rollNo); System.out.println(“Marks=” +marks); }   } class Main { public static void main(String args[]) { Student s1=new Student(); […]

Java Code: Count Leaf Nodes (Minimal Version)

Java Code: Count Leaf Nodes (Minimal Version) Here is a short and simple Java code to count the number of leaf nodes in a binary tree using recursion:   ✅ Java Code: Count Leaf Nodes (Minimal Version class Node { int data; Node left, right; Node(int data) { this.data = data; } }   public […]

EduLearn - Online Education Platform

Welcome to EduLearn!

Start learning today with our wide range of courses taught by industry experts. Gain new skills, advance your career, or explore new interests.

Browse Courses

Popular Courses

[Course Image]

Introduction to Programming

Learn the fundamentals of programming with Python in this beginner-friendly course.

12 Hours Beginner
[Course Image]

Data Science Essentials

Master the basics of data analysis, visualization, and machine learning.

20 Hours Intermediate
[Course Image]

Web Development Bootcamp

Build modern websites with HTML, CSS, JavaScript and popular frameworks.

30 Hours Beginner
[Course Image]

Digital Marketing Fundamentals

Learn SEO, social media marketing, email campaigns and analytics.

15 Hours Beginner
Educational Website Footer