CodeGym /Java Course /Java Collections /Tasks | Level 9 | Lesson 9

Tasks | Level 9 | Lesson 9

Java Collections
Level 9 , Lesson 9
Available

"Hi, Amigo. Here, take this interesting task:"

20
Task
Java Collections, level 9, lesson 9
Locked
Unique substrings
Implement the lengthOfLongestUniqueSubstring method so that it returns the length of the longest substring without repeated characters in the string passed as an argument. For example, for "a123bcbcqwe", it should return 6. For "ttttwt", it should return 2.
10
Task
Java Collections, level 9, lesson 9
Locked
Bits were bits
While developing a complex encryption algorithm, there was a need to determine whether the binary representation of a number has an even number of ones. Implement the boolean isWeightEven(long number) method.
20
Task
Java Collections, level 9, lesson 9
Locked
Unequal exchange
Continuing the development of the algorithm, we could really use a method that can swap specified bits in the binary representation of a long. Implement a long swapBits(long number, int i, int j) method that swaps the bits with indices i and j in the binary representation of number.
20
Task
Java Collections, level 9, lesson 9
Locked
Stairs
A boy runs up a flight of stairs consisting of n steps; in 1 bound, he can move up one, two or three steps. Implement the numberOfPossibleAscents(int n) method, which should return the number of ways the boy can ascend an entire flight of stairs consisting of n steps.
20
Task
Java Collections, level 9, lesson 9
Locked
Fill 'er up
While developing a new version of a popular graphics editor, it has become necessary to implement the ability to fill an area of an image with a specified color.
20
Task
Java Collections, level 9, lesson 9
Locked
Interfaces will save us!
Amigo, help... I have no idea what to do. I carefully followed the specifications, which required me to create a system for enabling an alarm. I created an alarm system (SecuritySystem) and power button (ElectricPowerSwitch), and verified that it works in the Solution class's main method.
10
Task
Java Collections, level 9, lesson 9
Locked
ISP
The Worker interface contains too many methods that do too many different things. As a result, classes that want to support only part of the functionality have to implement methods that they don't actually need.
20
Task
Java Collections, level 9, lesson 9
Locked
Is a palindrome possible?
Implement the isPalindromePermutation(String s) method. It should return true if you can make a palindrome from all the characters in string s. Otherwise, it should return false. The passed string includes only ASCII characters. Ignore the case of the letters.
20
Task
Java Collections, level 9, lesson 9
Locked
One change
Implement the isOneEditAway(String first, String second) method that returns true if it is possible to edit/add/delete one character in one of the strings to get the other string. The passed string includes only ASCII characters. Ignore the case of the characters.
10
Task
Java Collections, level 9, lesson 9
Locked
isPowerOfThree
Fix the bug in the isPowerOfThree(int n) method. It should return true if n is an integer power of the number 3. Otherwise, it should return false.
10
Task
Java Collections, level 9, lesson 9
Locked
Rollback
You must implement the rollback method in the Software class. It should make it possible to roll back the current software version to the desired version. All versions after the one we roll back to must be removed. And don't forget to change the currentVersion field.
20
Task
Java Collections, level 9, lesson 9
Locked
Maximum area
Implement the int maxSquare(int[][] matrix) method. IT returns the area of the largest square of ones in the two-dimensional array called matrix. The matrix array contains only zeros and ones.

"As usual, the secret agent will give you all of the implementation details."

Comments (5)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Justin Smith Level 41, Greenfield, USA, United States
29 April 2023
It seems like we're at a point where we get tasks related to all kinds of things across the entire course and not specifically related to the topic of this chapter (this chapter's lessons up to this point are probably not test-able anyway). You can start to get a feeling that we're getting close to the end. The given difficulty levels for these should be ignored. The second one is rated Easy but I had a pretty rough time with it (I found a solution without a problem, but it is looking for the single fastest possible solution, and so of the many ways of solving this it will only accept that specific solution). On the other hand, the first one is rated medium but I found it pretty easy.
Tom Level 41, San Jose, Sweden
17 June 2021
so many exciting exercise!🤓
Juan Ma Level 41, Arauca, Colombia
1 July 2020
In One change Task, it should have said: ...method that returns true if it is possible to edit/add/delete (AT MOST) one character... because, to pass validator, equal strings must return true.
matemate123 Level 50, Kraków, Poland
4 December 2023
edit/add/delete or without changes -> return true
fzw Level 41, West University Place, United States
13 May 2020
Fill 'er up: Along four directions(up, down, left, right) from starting point, if color is the same as original color of starting point, change its color to desired color.