M

@marish

Start output patter

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; /*for output patter * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

charArray

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". class Main { public static void main(String[] args) { //System.out.println("Hello world!"); String s2 = "aadbc";

array basics

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". class Main { public static void main(String[] args) { //System.out.println("Hello world!"); int[] a = new int[3] ;

All divisor of numbers

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". class Main { public static void main(String[] args) { //System.out.println("Hello world!"); Scanner s = new Scanner(Sy

LCM of 2 number

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". class Main { public static void main(String[] args) { // System.out.println("Hello world!"); Scanner s = new Scanner(Sy

GCD 14Feb2025

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". class Main { public static void main(String[] args) { // System.out.println("Hello world!"); Scanner s = new Scanner(Sy

Factorial 13Feb2025

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". class Main { public static void main(String[] args) { // System.out.println("Hello world!")

Recursion simple Dec of cards 54321

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". class Main { public static void main(String[] args) { //System.out.println("Hello world!"); Scanner sc = n

Recursion simple Dec of cards 54321

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // System.out.println("Hello world!"

Recursion sample example addition multiplication

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". class Main { public static void main(String[] args) { // System.out.println("Hello world!"); Scanner sc = new Scanner(Sy

Carry forward story print sum of 2 array integers

Java
2 years ago
import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". class Main { public static void main(String[] args) { // System.out.println("Hello world!"); int [] d1 = {7,8};

String simple example

Java
2 years ago
import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". class Main { public static void main(String[] args) { System.out.println("Hello world!"); int num = 'A'; Syste

SinglyLinkedlist sample example code

Java
2 years ago
import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". class Main { public static void main(String[] args) { //System.out.println("Hello world!"); SinglyLinkedlist list = new Si

Java Constructor example Dog

Java
2 years ago
//Here's a simple program example to illustrate the concept of a constructor: //Java's Constructor class Dog { String name; // This variable will store the dog's name // Constructor (like a recipe for creating a Dog object) public Dog(String

Linked List Part 1 code display prev, current and next assuming thathave 3 nodes h1,h2,h3 val1,2,3

Java
2 years ago
//important java util,lang,io import java.util.*; import java.lang.*; import java.io.*; // linked list simple code //pl write a program in Java for a single linked list of simple code to display prev, current and next //assuming that I have 3 node

hashset longest palindromic substring

Java
2 years ago
import java.util.HashSet; import java.util.Scanner; import java.util.Set; public class Main { // Function to check if a given string is a palindrome private static boolean isPalindrome(String s) { int start = 0; int end = s

List<Integer> frequencies = new ArrayList<>();

Java
2 years ago
List<Integer> frequencies = new ArrayList<>(); Certainly! Let's break down the line: ```java List<Integer> frequencies = new ArrayList<>(); ``` 1. `List<Integer>`: This part declares a variable named `frequencies` which is of type `List<Integer>`.

Hashmap J example

Java
2 years ago
import java.util.*; import java.lang.*; import java.io.*; // The main method must be in a class named "Main". class Main { public static void main(String[] args) { // System.out.println("Hello world!"); HashMap<String, Integer> hm =

You are given an integer A, you need to find and return the sum of all the even numbers between1to A

Java
2 years ago
import java.util.*; import java.lang.*; import java.io.*; //You are given an integer A, you need to find and return the sum of all the even numbers //between 1 and A. //Even numbers are those numbers that are divisible by 2. // The main method must

a function that takes an integer argument A. Return 1 if A is a perfect square else 0

Java
2 years ago
import java.util.*; import java.lang.*; import java.io.*; //a function that takes an integer argument A. Return 1 if A is a perfect square else 0 //A perfect square is an integer that is the square of an integer. For example 16 is perfect square as