Answered step by step
Verified Expert Solution
Question
1 Approved Answer
// you can write to stdout for debugging purposes, e.g. // console.log('this is a debug message'); task3 solution.js I test-input.txt Bob would like to add
// you can write to stdout for debugging purposes, e.g. // console.log('this is a debug message'); task3 solution.js I test-input.txt Bob would like to add as few letters as possible. In the example above, Bob added two letters, which is the minimum possible. Your task is to tell him the minimum number of letters that he needs to add to make the given words anagrams in this way. Write a function: function solution(A, B) { // write your code in JavaScript (Node.js 1.9.4) } function solution (A, B); II that, given two non-empty strings, A and B, consisting of N and M letters respectively, returns the minimum number of letters that Bob has to add to the words specified in A and B to make them anagrams. For example, given the words "rather" and 'harder' your function should return 2, as explained above. For the given words "apple" and "pear" your function should return 3, since you can add the letter 'r' to the first word and the letters 'p' and 'i'to the second word to form anagrams. And for the given words "lemon" and 'melon", your function should return O, since the given words are already anagrams. Write an efficient algorithm for the following assumptions: N and M are integers within the range (1...100,000); string ('A', 'B') consists only of lowercase letters (a-z). Test Output Run Tests
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started