Skip to content

vrinhae/publicLab01

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Review Assignment Due Date

CS 245 - Lab Assignment 01 Fall 2025

Find the Missing Number

The goal of this assignment is to demonstrate your mastery of Java programming by solving the following problem, while getting used the GitHub environment.

Background

Given an array nums containing n distinct and consecutive integers in the range of 0..n, where n is the size of the array, return the number in the range that is missing from the array. The given array will have no repeated values.

Requirements

Find the missing number in an unsorted array of integers. The built-in Collections.sort() method is not allowed in this lab. Hint: you can use nums.size to figure out the largest possible number within the unsorted array. Please assume test cases will have the correct size within the array. Java int arrays initialize empty indexes as 0.

Constraints

0 <= n <= 1000; where n is the size of the array Your class must be called Lab01, and there must contain a method with the signature: public static int findMissingNum(int[] nums){} Starter code for this assignment is available via https://classroom.github.com/a/gYDt-elW.

Examples

Example 1:

Input: nums = [3,0,1]

Output: 2 Explanation: 2 is missing from 0 to 3.

Example 2:

Input: nums = [4,6,2,3,1,5]

Output: 0 Explanation: 0 is missing from 0 to 6.

Example 3:

Input: nums = [4,6,2,3,5,0]

Output: 1 Explanation: 1 is missing from 0 to 6.

Example 4:

Input: nums = [2,3,1,0]

Output: 4 Explanation: 4 is missing from 0 to 4.

Submission

Upload your Lab01.java in your GitHub repo. Submit the source code for your implementation on Canvas. You may also add any comments in Lab01.java to help the grader understand or execute your implementation. The source code for your implementation must be in Java.

Grading

You will earn a token if your code in your GitHub repo at 11:59pm on Friday, August 29th passes all 10 test cases in Lab10Test.java.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages