The first 10 common multiples of 3 and 5 are arranged in ascending order. find the range of the array formed
Answers
Step-by-step explanation:
Hii mate here is ur answer plz mark me as brainlist friend and thank me...plz give more thanks and get thanks don't forget to follow me #friend══════ •『 ♡』• ════════════ •『 ♡』• ═══════════
see this
══════ •『 ♡』• ════════════ •『 ♡』• ════════════
ƒσłłσω мε
GIVE THANKS = TAKE THANKS
Step-by-step explanation:
search
Sign In
Home
Courses
Algorithmskeyboard_arrow_down
Data Structureskeyboard_arrow_down
Languageskeyboard_arrow_down
Interview Cornerkeyboard_arrow_down
GATEkeyboard_arrow_down
CS Subjectskeyboard_arrow_down
Studentkeyboard_arrow_down
GBlog
Puzzles
What's New ?
▲
Find the largest multiple of 3 | Set 1 (Using Queue)
Last Updated: 31-05-2019
Given an array of non-negative integers. Find the largest multiple of 3 that can be formed from array elements.
For example, if the input array is {8, 1, 9}, the output should be “9 8 1”, and if the input array is {8, 1, 7, 6, 0}, output should be “8 7 6 0”.
Method 1 (Brute Force)
The simple & straight forward approach is to generate all the combinations of the elements and keep track of the largest number formed which is divisible by 3.
Time Complexity: O(n x 2^n). There will be 2^n combinations of array elements. To compare each combination with the largest number so far may take O(n) time.
Auxiliary Space: O(n) // to avoid integer overflow, the largest number is assumed to be stored in the form of array.
hope it is easy
pls make my answer brainlest