From the course: Nail Your Java Interview
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Challenge: Maximum product of two numbers - Java Tutorial
From the course: Nail Your Java Interview
Challenge: Maximum product of two numbers
(upbeat music) - [Instructor] This challenge will test your knowledge of arrays in Java, as well as your algorithm skills. You'll create a function that finds the maximum product of two numbers in an unsorted array. Your function will take one input, an array containing integers, and it will output the maximum product of two integers inside that array. For example, if you are given the following array with five, three, two, five, seven, zero, and one, the maximum product is five times seven, which is 35. Your function would return 35. You could also be given an array with negative numbers. In this case, the maximum product would be negative three times negative eight, which is 24. If you're interested in more technical problems, I suggest you iterate on this challenge. What if you had to return the pair of indices instead of the maximum product? How would your algorithm change? What if I asked for the minimum product?…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Review arrays for technical interviews6m 7s
-
(Locked)
Challenge: Maximum product of two numbers1m 11s
-
(Locked)
Solution: Maximum product of two numbers6m 26s
-
(Locked)
Mastering linked lists for whiteboard coding interviews7m 1s
-
(Locked)
Challenge: Delete the middle of a singly-linked list55s
-
(Locked)
Solution: Delete the middle of a singly-linked list4m 27s
-
-
-
-