Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

answer ASAP plz. i will rate. need the code in JAVASCRIPT. USE THE FOLLOWING FUNCTION HEADER ONLY PLZ! picture of the required function header also

answer ASAP plz. i will rate. need the code in JAVASCRIPT. USE THE FOLLOWING FUNCTION HEADER ONLY PLZ! picture of the required function header also attached at the end of the picture. picture of the question is also attached!
function deviceNamesSystem(devicenames) {
//write your code here
}
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Create unique device names to be used in a residential loT (Internet of Things) system. If a device name already exists in the system, an integer number is added at the end of the name to make it unique. The integer[added starts with 1 and is incremented by 1 for each new request of an existing device name. Given a list of device name requests, process all requests and return an array of the corresponding unique device names. Example n = 6 devicenames = ['switch' , 'tv, 'switch', 'tv', 'switch', 'tv'] devicenames[0] = "switch" is unique. uniqueDevicename[0]="switch" . . devicenames[0] - "switch" is unique. uniqueDevicename[0]="switch" devicenames[1] = "t" is unique. uniqueDevicename[1]="TV" devicenames[2)=devicenames[0]. Add 1 at the end the previous unique username "switch". uniqueDevicename[2]="switch1" devicenames[3) = devicenames(1). Add .1 at the end the previous unique username "t". W uniqueDevicename[3) "tv1" devicenames[4] =devicenames[2]. Increment by 1 the number at the end of the previous unique username "switch1", unique Devicenames[4]="switch2" devicenames(5) = devicenames[3). Increment by 1 the number at the end of the previous unique username "t1" unique Devicenames[5]="tV2" return uniqueDevicenames = ['switch tv switch tv1 'switch2, tv2] . . Function Description Function Description Complete the function deviceNamesSystem in the editor below. deviceNamesSystem has the following parameter(s); string devicenames[di: an array of device name strings in the order requested. Returns string[n): an array of string usernames in the order assigned Constraints . 15 ns104 1 s length of devicenames[i]* 20 devicenames[i] contains only lowercase English letters in the range ascii[a-z]. Input Format for Custom Testing Sample Case 0 Constraints 13n

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

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions