diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-01-29 13:57:29 +0000 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2023-01-29 13:57:29 +0000 |
| commit | ff9c2dc64f984f4e5be20ce7b492f02966cd2439 (patch) | |
| tree | 9bdd5d96cf49c686532dfca1287ab455dc0ac4f8 /challenge-201 | |
| parent | 271b545bdf999895f716e3fdd1294e0f522a047e (diff) | |
| download | perlweeklychallenge-club-ff9c2dc64f984f4e5be20ce7b492f02966cd2439.tar.gz perlweeklychallenge-club-ff9c2dc64f984f4e5be20ce7b492f02966cd2439.tar.bz2 perlweeklychallenge-club-ff9c2dc64f984f4e5be20ce7b492f02966cd2439.zip | |
- Added solutions by Mark Anderson.
- Added solutions by Bob Lied.
- Added solutions by Mariano Spadaccini.
- Added solutions by Peter Campbell Smith.
- Added solutions by Luca Ferrari.
- Added solutions by W. Luis Mochan.
- Added solutions by Carlos Oliveira.
- Added solutions by Dave Jacoby.
- Added solutions by E. Choroba.
- Added solutions by David Ferrone.
- Added solutions by Roger Bell_West.
- Added solutions by Simon Green.
- Added solutions by Thomas Kohler.
- Added solutions by Arpad Toth.
- Added solutions by Robbie Hatley.
- Added solutions by Jorg Sommrey.
- Added solutions by PokGoPun.
- Added solutions by Pip Stuart.
- Added solutions by Ali Moradi.
- Added solutions by Robert Ransbottom.
- Added solutions by Ulrich Rieke.
- Added solutions by Robert DiCicco.
- Added solutions by Cheok-Yin Fung.
Diffstat (limited to 'challenge-201')
22 files changed, 508 insertions, 124 deletions
diff --git a/challenge-201/arpad-toth/ch200-1.pl b/challenge-201/arpad-toth/ch200-1.pl deleted file mode 100644 index 5d2bf7fa07..0000000000 --- a/challenge-201/arpad-toth/ch200-1.pl +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; -use feature 'say'; - -my @o=@ARGV; -push my @slc,$o[0],$o[1]; -sub sayno{say "no slice found"}; -sayno if scalar(@ARGV)<3; -my $fl=0; - -#build slices -while(scalar(@o)>=2){ - my $delta=$o[1]-$o[0]; - for(2..$#o){push @slc,$o[$_] and say "(@slc)" and $fl=1 if($o[$_]-$o[$_-1] == $delta) || last}; - splice(@o,0,1); - undef(@slc);push @slc,$o[0],$o[1]; -} -$fl==1 ? exit : sayno; - diff --git a/challenge-201/arpad-toth/ch200-2.pl b/challenge-201/arpad-toth/ch200-2.pl deleted file mode 100644 index 7e18da211c..0000000000 --- a/challenge-201/arpad-toth/ch200-2.pl +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; -use feature 'say'; - -# line1 -for(0..$#ARGV){ -if($ARGV[$_] == 1 -or $ARGV[$_] == 4){&space7;if($_<$#ARGV){&space};if($_==$#ARGV){print "\n"}}; - -if($ARGV[$_] == 2 -or $ARGV[$_] == 3 -or $ARGV[$_] == 5 -or $ARGV[$_] == 6 -or $ARGV[$_] == 7 -or $ARGV[$_] == 8 -or $ARGV[$_] == 9 -or $ARGV[$_] == 0){&draw_147;if($_<$#ARGV){&space};if($_==$#ARGV){print "\n"}}; -} - -# line23 -for(1..2){ -for(0..$#ARGV){ -if($ARGV[$_] == 5 -or $ARGV[$_] == 6){&draw_2356_l;if($_<$#ARGV){&space};if($_==$#ARGV){print "\n"}}; - -if($ARGV[$_] == 1 -or $ARGV[$_] == 2 -or $ARGV[$_] == 3 -or $ARGV[$_] == 7){&draw_2356_r;if($_<$#ARGV){&space};if($_==$#ARGV){print "\n"}}; - -if($ARGV[$_] == 4 -or $ARGV[$_] == 8 -or $ARGV[$_] == 9 -or $ARGV[$_] == 0){&draw_2356_b;if($_<$#ARGV){&space};if($_==$#ARGV){print "\n"}}; -} -} - -# line4 -for(0..$#ARGV){ -if($ARGV[$_] == 2 -or $ARGV[$_] == 3 -or $ARGV[$_] == 4 -or $ARGV[$_] == 5 -or $ARGV[$_] == 6 -or $ARGV[$_] == 8 -or $ARGV[$_] == 9){&draw_147;if($_<$#ARGV){&space};if($_==$#ARGV){print "\n"}}; - -if($ARGV[$_] == 1 -or $ARGV[$_] == 7 -or $ARGV[$_] == 0){&space7;if($_<$#ARGV){&space};if($_==$#ARGV){print "\n"}}; -} -# line56 -for(1..2){ -for(0..$#ARGV){ -if($ARGV[$_] == 2){&draw_2356_l;if($_<$#ARGV){&space};if($_==$#ARGV){print "\n"}}; - -if($ARGV[$_] == 1 -or $ARGV[$_] == 3 -or $ARGV[$_] == 4 -or $ARGV[$_] == 5 -or $ARGV[$_] == 7 -or $ARGV[$_] == 9){&draw_2356_r;if($_<$#ARGV){&space};if($_==$#ARGV){print "\n"}}; - -if($ARGV[$_] == 6 -or $ARGV[$_] == 8 -or $ARGV[$_] == 0){&draw_2356_b;if($_<$#ARGV){&space};if($_==$#ARGV){print "\n"}}; -} -} - -# line7 -for(0..$#ARGV){ -if($ARGV[$_] == 1 -or $ARGV[$_] == 4 -or $ARGV[$_] == 7){&space7;if($_<$#ARGV){&space};if($_==$#ARGV){print "\n"}}; - -if($ARGV[$_] == 2 -or $ARGV[$_] == 3 -or $ARGV[$_] == 5 -or $ARGV[$_] == 6 -or $ARGV[$_] == 8 -or $ARGV[$_] == 9 -or $ARGV[$_] == 0){&draw_147;if($_<$#ARGV){&space};if($_==$#ARGV){print "\n"}}; -} - -# line1 - (2,3,5,6,7,8,9,0) - (-------) -# line2,3 -left - (5,6) - (|) -# line2,3 -right- (1,2,3,7) - (|) -# line2,3 -both-(4,8,9,0) (| |) -# line4 - (2,3,4,5,6,8,9) - (-------) -# line5,6 -left - (2) - (|) -# line5,6 -right - (1,3,4,5,7,9) (|) -# line5,5 -both-(6,8,0) (| |) -# line7 - (2,3,5,6,8,9,0) - (-------) - -sub draw_147{print "-"x7}; -sub draw_2356_l{printf"%-7s","|"}; -sub draw_2356_r{printf"%7s","|"}; -sub draw_2356_b{printf"%s","| |"}; -sub space{print " "}; -sub space7{print " "x7}; - diff --git a/challenge-201/arpad-toth/ch201-1.pl b/challenge-201/arpad-toth/perl/ch-1.pl index aeb0123ba6..aeb0123ba6 100644 --- a/challenge-201/arpad-toth/ch201-1.pl +++ b/challenge-201/arpad-toth/perl/ch-1.pl diff --git a/challenge-201/arpad-toth/ch201-2.pl b/challenge-201/arpad-toth/perl/ch-2.pl index d1ad647402..d1ad647402 100644 --- a/challenge-201/arpad-toth/ch201-2.pl +++ b/challenge-201/arpad-toth/perl/ch-2.pl diff --git a/challenge-201/eric-cheung/python/ch-1.py b/challenge-201/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..da9bdec3ed --- /dev/null +++ b/challenge-201/eric-cheung/python/ch-1.py @@ -0,0 +1,8 @@ +
+## nInputArr = [0, 1, 3] ## Example 1
+nInputArr = [0, 1] ## Example 2
+
+nFullArr = range(0, len(nInputArr) + 1)
+nComplementArr = [nElemLoop for nElemLoop in nFullArr if nElemLoop not in nInputArr]
+
+print (nComplementArr)
diff --git a/challenge-201/eric-cheung/python/ch-2.py b/challenge-201/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..8aaeccba36 --- /dev/null +++ b/challenge-201/eric-cheung/python/ch-2.py @@ -0,0 +1,22 @@ +
+## Remarks
+## https://theweeklychallenge.org/blog/perl-weekly-challenge-201/
+## https://www.geeksforgeeks.org/count-ways-reach-nth-stair/
+
+## Python Program to Count Ways to Reach Nth stair
+
+## Recursive Function to Find Nth Fibonacci Number
+def GetFibNum(nInput):
+
+ if nInput <= 1:
+ return nInput
+
+ return GetFibNum(nInput - 1) + GetFibNum(nInput - 2)
+
+
+## Driver Program
+nInputNum = 5
+
+print ("Number of Ways: " + str(GetFibNum(nInputNum + 1)))
+
+## Contributed by Harshit Agrawal
diff --git a/challenge-201/robbie-hatley/c/part.c b/challenge-201/robbie-hatley/c/ch-2.c index 46d184d625..46d184d625 100644 --- a/challenge-201/robbie-hatley/c/part.c +++ b/challenge-201/robbie-hatley/c/ch-2.c diff --git a/challenge-201/robert-dicicco/julia/ch-1.jl b/challenge-201/robert-dicicco/julia/ch-1.jl new file mode 100644 index 0000000000..8afc9f2877 --- /dev/null +++ b/challenge-201/robert-dicicco/julia/ch-1.jl @@ -0,0 +1,57 @@ +#!/usr/bin/env julia + +#= + +AUTHOR: Robert DiCicco + +DATE: 2023-01-23 + +Challenge 201 Missing Numbers ( Julia ) + +=# + +using Printf + + + +arrs = [[0,1,3],[0,1]] + + + +for arr in arrs + + @printf("Input: @array = %s\n",arr) + + len = length(arr) + + for x = 0:len + + if !(x in arr) + + @printf("Output: %d\n\n", x) + + end + + end + +end + + + +#= + +SAMPLE OUTPUT + +julia .\MissingNumbers.jl + +Input: @array = [0, 1, 3] + +Output: 2 + + + +Input: @array = [0, 1] + +Output: 2 + +=# diff --git a/challenge-201/robert-dicicco/perl/ch-1.pl b/challenge-201/robert-dicicco/perl/ch-1.pl new file mode 100644 index 0000000000..ecff735a89 --- /dev/null +++ b/challenge-201/robert-dicicco/perl/ch-1.pl @@ -0,0 +1,67 @@ +#!/usr/bin/env perl + +=begin comment + +AUTHOR: Robert DiCicco + +DATE: 2023-01-23 + +Challenge 201 Missing Numbers ( Perl ) + +=cut + +use strict; + +use warnings; + +use feature qw/say/; + + + +my @arrs = ([0,1,3],[0,1]); + + + + + +for my $arr (@arrs) { + + my $len = @$arr; + + print("Input: \@array = \[@$arr\]\n"); + + for (my $x = 0; $x <= $len; $x++ ){ + + if ( grep( /$x/, @$arr ) ) { + + next; + + } else { + + print "Output: $x\n\n"; + + } + + } + +} + + + +=begin comment + +SAMPLE OUTPUT + +perl .\MissingNumbers.pl + +Input: @array = [0 1 3] + +Output: 2 + + + +Input: @array = [0 1] + +Output: 2 + +=cut diff --git a/challenge-201/robert-dicicco/python/ch-1.py b/challenge-201/robert-dicicco/python/ch-1.py new file mode 100644 index 0000000000..554d7da0bf --- /dev/null +++ b/challenge-201/robert-dicicco/python/ch-1.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python + +''' + +AUTHOR: Robert DiCicco + +DATE: 2023-01-23 + +Challenge 201 Missing Numbers ( Python ) + +''' + +arrs = [[0,1,3],[0,1]] + + + +for arr in arrs: + + print(f"Input: @array = {arr}") + + arrlen = len(arr) + + for x in range(arrlen+1) : + + if x not in arr : + + print("Output: ",x,"\n") + + + +''' + +SAMPLE OUTPUT + +python .\MissingNumbers.py + +Input: @array = [0, 1, 3] + +Output: 2 + + + +Input: @array = [0, 1] + +Output: 2 + +''' diff --git a/challenge-201/robert-dicicco/raku/ch-1.raku b/challenge-201/robert-dicicco/raku/ch-1.raku new file mode 100644 index 0000000000..8a6e9ab28b --- /dev/null +++ b/challenge-201/robert-dicicco/raku/ch-1.raku @@ -0,0 +1,55 @@ +#!/usr/bin/env raku + +#`{ + +AUTHOR: Robert DiCicco + +DATE: 2023-01-23 + +Challenge 201 Missing Numbers ( Raku ) + +} + +use v6; + + + +my @arrs = [[0,1,3],[0,1]]; + + + +for (@arrs) -> @arr { + + my $len = @arr.elems; + + print("Input: \@array = [",@arr,"]\n"); + + my %hash = map {$_ => 1}, @arr; + + for (0..$len) -> $x { + + say "Output: $x\n" if ! %hash{$x}; + + } + +} + + + +#`{ + +SAMPLE OUTPUT + +raku .\MissingNumbers.rk + +Input: @array = [0 1 3] + +Output: 2 + + + +Input: @array = [0 1] + +Output: 2 + +} diff --git a/challenge-201/robert-dicicco/ruby/ch-1.rb b/challenge-201/robert-dicicco/ruby/ch-1.rb new file mode 100644 index 0000000000..589cc88626 --- /dev/null +++ b/challenge-201/robert-dicicco/ruby/ch-1.rb @@ -0,0 +1,55 @@ +#!/usr/bin/env ruby + +=begin + +AUTHOR: Robert DiCicco + +DATE: 2023-01-23 + +Challenge 201 Missing Numbers ( Ruby ) + +=end + + + +arrs = [[0,1,3],[0,1]] + + + +arrs.each do |arr| + + puts("Input: \@array = #{arr}") + + len = arr.length(); + + for x in 0..len + + unless arr.include? x + + puts("Output: #{x}","") + + end + + end + +end + + + +=begin + +SAMPLE OUTPUT + +ruby .\MissingNumbers.rb + +Input: @array = [0, 1, 3] + +Output: 2 + + + +Input: @array = [0, 1] + +Output: 2 + +=end diff --git a/challenge-201/ulrich-rieke/cpp/ch-1.cpp b/challenge-201/ulrich-rieke/cpp/ch-1.cpp new file mode 100644 index 0000000000..b2945d9bbd --- /dev/null +++ b/challenge-201/ulrich-rieke/cpp/ch-1.cpp @@ -0,0 +1,37 @@ +#include <iostream> +#include <string> +#include <vector> +#include <algorithm> +#include <iterator> + +std::vector<std::string> split( const std::string & startline , const std::string & sep ) { + std::vector<std::string> separated ; + std::string::size_type start { 0 } ; + std::string::size_type pos ; + do { + pos = startline.find_first_of( sep , start ) ; + separated.push_back( startline.substr(start , pos - start )) ; + start = pos + 1 ; + } while ( pos != std::string::npos ) ; + return separated ; +} + +int main( ) { + std::cout << "Please enter some unique integers, separated by blanks!\n" ; + std::string line ; + std::getline( std::cin , line ) ; + std::vector<int> numbers ; + std::vector<std::string> numberstrings( split( line , " " ) ) ; + std::vector<int> missingNumbers ; + for ( auto & s : numberstrings ) + numbers.push_back( std::stoi( s ) ) ; + int len = numbers.size( ) ; + for ( int i = 0 ; i < len + 1 ; i++ ) { + if ( std::find( numbers.begin( ) , numbers.end( ) , i ) == numbers.end( ) ) + missingNumbers.push_back( i ) ; + } + std::copy( missingNumbers.begin( ) , missingNumbers.end( ) , + std::ostream_iterator<int>( std::cout , " " ) ) ; + std::cout << std::endl ; + return 0 ; +} diff --git a/challenge-201/ulrich-rieke/haskell/ch-1.hs b/challenge-201/ulrich-rieke/haskell/ch-1.hs new file mode 100644 index 0000000000..ef042bc50f --- /dev/null +++ b/challenge-201/ulrich-rieke/haskell/ch-1.hs @@ -0,0 +1,5 @@ +module Challenge201 + where + +solution :: [Int] -> [Int] +solution list = filter (\n -> not $ elem n list ) [0..length list] diff --git a/challenge-201/ulrich-rieke/haskell/ch-2.hs b/challenge-201/ulrich-rieke/haskell/ch-2.hs new file mode 100644 index 0000000000..95fed521f5 --- /dev/null +++ b/challenge-201/ulrich-rieke/haskell/ch-2.hs @@ -0,0 +1,22 @@ +module Challenge201_2 + where +import qualified Data.Set as S + +combinations :: Int -> [a] -> [[a]] +combinations 0 _ = [[]] +combinations n xs = [ xs !! i : x | i <- [0..(length xs ) - 1 ] , +x <- combinations (n - 1 ) ( drop ( i + 1 ) xs ) ] + +--a list that contains all numbers from 1 to n as often as necessary to sum up to n +allNumberCombis :: Int -> [Int] +allNumberCombis n = concat $ map (\i -> replicate ( div n i ) i ) [1..n] + +--create all combinations of 2 to n - 1 elements , consider every list only once +--by making a transitional set of them, and add 2 to take n times 1 and 1 times n +--into account +solution :: Int -> Int +solution n = length (filter ( (== n ) . sum ) $ S.toList $ S.fromList $ concat $ map +(\i -> combinations i theCombis ) [2..n - 1]) + 2 +where + theCombis :: [Int] + theCombis = allNumberCombis n diff --git a/challenge-201/ulrich-rieke/perl/ch-1.pl b/challenge-201/ulrich-rieke/perl/ch-1.pl new file mode 100644 index 0000000000..609fcaa21b --- /dev/null +++ b/challenge-201/ulrich-rieke/perl/ch-1.pl @@ -0,0 +1,19 @@ +#!/usr/bin/perl ; +use strict ; +use warnings ; +use feature 'say' ; + +say "Enter some integers, separated by a blank!" ; +my $line = <STDIN> ; +chomp $line ; +my @numbers = split( /\s/ , $line ) ; +my $len = scalar( @numbers ) ; +my %found ; +map { $found{$_}++ } @numbers ; +my @missingNumbers ; +for my $n (0..$len ) { + unless ( exists( $found{ $n } )) { + push @missingNumbers , $n ; + } +} +say join( ',' , @missingNumbers ) ; diff --git a/challenge-201/ulrich-rieke/perl/ch-2.pl b/challenge-201/ulrich-rieke/perl/ch-2.pl new file mode 100644 index 0000000000..2932de669b --- /dev/null +++ b/challenge-201/ulrich-rieke/perl/ch-2.pl @@ -0,0 +1,19 @@ +#!/usr/bin/perl ; +use strict ; +use warnings ; +use feature 'say' ; +use Algorithm::Combinatorics qw ( combinations_with_repetition ) ; +use List::Util qw ( sum ) ; + +my $number = $ARGV[0] ; +my $heapSum = 2 ;#$number times 1 and 1 times $number pennies are already there +my @numbers = (1..$number) ; +for my $num ( 2..$number - 1 ) { + my $iter = combinations_with_repetition(\@numbers , $num ) ; + while ( my $p = $iter->next ) { + if ( sum( @$p ) == $number ) { + $heapSum++ ; + } + } +} +say $heapSum ; diff --git a/challenge-201/ulrich-rieke/raku/ch-1.raku b/challenge-201/ulrich-rieke/raku/ch-1.raku new file mode 100644 index 0000000000..a9dd81d1a1 --- /dev/null +++ b/challenge-201/ulrich-rieke/raku/ch-1.raku @@ -0,0 +1,13 @@ +use v6 ; + +say "Please enter some unique integers, separated by a blank!" ; +my $line = $*IN.get ; +my @numbers = $line.words.map( {.Int} ) ; +my $numberset = @numbers.Set ; +my @missingNumbers ; +for (0..@numbers.elems) -> $n { + unless ( $n (elem) $numberset ) { + @missingNumbers.push( $n ) ; + } +} +say @missingNumbers ; diff --git a/challenge-201/ulrich-rieke/raku/ch-2.raku b/challenge-201/ulrich-rieke/raku/ch-2.raku new file mode 100644 index 0000000000..1c56efbc18 --- /dev/null +++ b/challenge-201/ulrich-rieke/raku/ch-2.raku @@ -0,0 +1,23 @@ +use v6 ; + +sub MAIN( Int $num ) { +#add every number from 1 to $num as many times as it can be added to be +#summed up to $num , then find combinations from them + my @allNumbers ; + for (1..$num) -> $n { + @allNumbers.push( |($n xx ( $num div $n )) ) ; + } + my $allHeaps = 2 ; # $num times one pennies and one time $num pennies + my @allCombis ; #combinations of 1 to $num , consisting of 2 to $num - 1 numb. + for (2..$num - 1 ) -> $n { + for @allNumbers.combinations( $n ) -> $combi { + @allCombis.push( $combi ) ; + } + } +#every sequence, created by the combinations method , is to be included +#only once. For this purpose, we join the digits in each sequence , use that +#as 'unique' criterion and take the sequences apart again +my @candidates = @allCombis.map( {.join} ).unique.map( {.comb} ) ; ; +$allHeaps += @candidates.grep( {$_.sum == $num} ).elems ; +say $allHeaps ; +} diff --git a/challenge-201/ulrich-rieke/rust/ch-1.rs b/challenge-201/ulrich-rieke/rust/ch-1.rs new file mode 100644 index 0000000000..6741a7f7d9 --- /dev/null +++ b/challenge-201/ulrich-rieke/rust/ch-1.rs @@ -0,0 +1,19 @@ +use std::io ; + +fn main() { + println!("Please enter some unique integers, separated by a blank!" ) ; + let mut inline : String = String::new( ) ; + io::stdin( ).read_line( &mut inline ).unwrap( ) ; + let entered_line : &str = &*inline ; + let numbers : Vec<i32> = entered_line.split_whitespace( ).map( | s | + s.trim( ).parse::<i32>( ).unwrap( ) ).collect( ) ; + let len = numbers.len( ) ; + let mut missing_numbers : Vec<i32> = Vec::new( ) ; + for n in 0..=len { + let found = numbers.iter( ).find( | i | **i == n as i32 ) ; + if found.is_none( ) { + missing_numbers.push( n as i32 ) ; + } + } + println!("{:?}" , missing_numbers ) ; +} diff --git a/challenge-201/ulrich-rieke/rust/ch-2.rs b/challenge-201/ulrich-rieke/rust/ch-2.rs new file mode 100644 index 0000000000..8e66e8f1ee --- /dev/null +++ b/challenge-201/ulrich-rieke/rust/ch-2.rs @@ -0,0 +1,22 @@ + +use itertools::Itertools ; +use std::env ; + +fn main() { + let mut arguments : Vec<String> = Vec::new( ) ; + for arg in env::args( ) { + arguments.push( arg ) ; + } + let number : i32 = arguments[1].parse::<i32>( ).unwrap( ) ; + let mut heapsum : i32 = 2 ; //one heap with n pennies and n heaps with + //one penny + for n in 2..=number - 1 { + let mut it = (1..=number).combinations_with_replacement( n as usize) ; + while let Some( v ) = it.next( ) { + if v.iter( ).sum::<i32>( ) == number { + heapsum += 1 ; + } + } + } + println!("{}" , heapsum ) ; +} diff --git a/challenge-201/ziameraj16/java/MissingNumbers.java b/challenge-201/ziameraj16/java/MissingNumbers.java new file mode 100644 index 0000000000..a4cc181772 --- /dev/null +++ b/challenge-201/ziameraj16/java/MissingNumbers.java @@ -0,0 +1,18 @@ +import java.util.*; +import java.util.stream.Collectors; + +public class MissingNumbers { + + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + System.out.println("Enter comma separated values"); + List<Integer> list = Arrays.stream(scanner.nextLine().split(",")).map(Integer::valueOf).collect(Collectors.toList()); + List<Integer> missingNumbers = new ArrayList(list.size()); + for (int i = 0; i <= list.size(); i++) { + if (!list.contains(i)) { + missingNumbers.add(i); + } + } + System.out.println(missingNumbers); + } +} |
