Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Java, Do not import any packages (only java.lang.*), write public static boolean func(int num) It checks if all digits in num are in the

Use Java, Do not import any packages (only java.lang.*), write public static boolean func(int num)

It checks if all digits in num are in the same row or column of the numpad. If num only has 1 digit (0 - 9), it will count as in the same row or column. You can assume that num is not negative. The rows of the numpad are {0, 123, 456, 789}, and the columns are {0147, 0258, 0369}. Notice that 0 is a wildcard that counts for all three columns.

7

8

9

4

5

6

1

2

3

0

Examples:

input: 45767

output: false

input: 11231

output: true

input:7711404

output: true

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Oracle8I Building Efficient Databases

Authors: Jonathan Lewis

1st Edition

0201715848, 978-0201715842

More Books

Students also viewed these Databases questions

Question

What is the ULPA? Describe it.

Answered: 1 week ago

Question

=+2. Do they use a similar tone of voice and point of view?

Answered: 1 week ago