Skip to content

Latest commit

 

History

History
54 lines (36 loc) · 1.41 KB

JavaLeetcode.md

File metadata and controls

54 lines (36 loc) · 1.41 KB

JavaLeetcode

This repository contains a Java program that removes duplicates from an array in-place and returns the number of unique elements.

Prerequisites

  • Java Development Kit (JDK) installed on your machine
  • Command-line interface (Terminal or Command Prompt)

Building and Running the Program

  1. Clone or download this repository to your local machine.
  2. Open a terminal or command prompt.
  3. Navigate to the root directory of the project.
  4. Compile the Java code using the following command:
javac -d bin src/*.java src/easy/*.java src/medium/*.java

This command compiles all the Java files in the src directory and places the compiled .class files in the bin directory.

  1. Once the compilation is successful, navigate to the bin directory:
cd bin
  1. Run the Java program using the following command:
java JavaLeetcode.src.Main

This command runs the Main class, which serves as the entry point of the program.

  1. The program should start executing, and you will see the output printed in the terminal or command prompt.

Example output:

Number of unique elements: 2
Modified array: 1 2
Number of unique elements: 5
Modified array: 0 1 2 3 4
  1. You have successfully built and run the Java program!

See Difficulty Breakdowns

  1. Easy Challenges
  2. Medium Challenges
  3. Hard Challenges