Question: Write a recursive java method that receives a reference to the root of a binary tree that contains characters ( upper and lowercase letters from

Write a recursive java method that receives a reference to the root of a binary tree that contains characters (upper and lowercase letters from the English alphabet, digits, and special characters) and then prints and returns the count of all valid passwords constructed from the values in the nodes of the tree when traversed in a pretorder traversal.
Important notes:
1- A password is valid if it is of at least 6 characters of length and contains at least one lowercase letter, and one uppercase letter, two digits and one of the following special characters (@,*, $,!, and &).
2- Characters of the password must be in the order they appear when the tree is traversed in a pretorder traversal.
3- Your method must find the result with minimum time.
4- You cannot use any other data structure (array, arraylist, linked list, set, stack, queue, ... etc. are all not allowed).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!