Skip to content

Instantly share code, notes, and snippets.

View Ram-1234's full-sized avatar
🔍
looking for job change

Ramnayan yadav Ram-1234

🔍
looking for job change
View GitHub Profile
@Ram-1234
Ram-1234 / max subarray problem
Created June 29, 2021 17:08
Maximum Sub Array Problem
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
@Ram-1234
Ram-1234 / inheritence
Created June 29, 2021 04:02
Inheritence in Java
//Inheritance in Java is a mechanism in which one object acquires all the properties and behaviors of a parent object.
//It is an important part of OOPs (Object Oriented programming system).
class Employee{
float salary=40000;
}
class Programmer extends Employee{
int bonus=10000;
public static void main(String args[]){
1-If subclass (child class) has the same method as declared in the parent class, it is known as method overriding in Java.
2-In other words, If a subclass provides the specific implementation of the method that has been declared by one of its parent class,
it is known as method overriding.
//Java Program to illustrate the use of Java Method Overriding
//Creating a parent class.
class Vehicle{
//defining a method
@Ram-1234
Ram-1234 / method overloading
Created June 29, 2021 03:55
Method Overloding in java
//If a class has multiple methods having same name but different in parameters, it is known as Method Overloading.
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
@Ram-1234
Ram-1234 / binary serach
Created June 21, 2021 03:06
Find an Element In a Sorted Array Using Binary Search
input:
6
5
1 3 5 7 9 11
output:
Success #stdin #stdout 0.1s 49484KB
element found
/* package whatever; // don't place package name! */
@Ram-1234
Ram-1234 / array rotation
Created June 19, 2021 02:17
Array Rotation in Java
Description:
Before Rotation
1 2 3
4 5 6
7 8 9
after rotation
7 4 1
8 5 2
9 6 3
@Ram-1234
Ram-1234 / java hashmap uniqe character find out
Last active June 13, 2021 11:56
Unique Character In String
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
@Ram-1234
Ram-1234 / kth smallest array element
Last active May 22, 2021 01:53
Kth smallest array element using max heap
Example:-
input:
array size=5
kth number =2
arr[]={9,2,15,3,16}
/* package whatever; // don't place package name! */
import java.util.*;
@Ram-1234
Ram-1234 / Kth largest element
Last active May 22, 2021 01:54
Kth largest array element without array sort method, using min heap
example:-
input:
array size=5
kth =3
arr[]={9 12 2 15 2}
output:
9
@Ram-1234
Ram-1234 / remove substring
Created April 30, 2021 16:57
remove a substring from given string
Example-1
input;-
I am a very good engineer
very
output:-
I am a good engineer