This repository contains a Java program that removes duplicates from an array in-place and returns the number of unique elements.
- Java Development Kit (JDK) installed on your machine
- Command-line interface (Terminal or Command Prompt)
- Clone or download this repository to your local machine.
- Open a terminal or command prompt.
- Navigate to the root directory of the project.
- 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.
- Once the compilation is successful, navigate to the
bin
directory:
cd bin
- 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.
- 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
- You have successfully built and run the Java program!