Code Monkey home page Code Monkey logo

playing-with-anagrams's Introduction

Playing With Anagrams

We define an anagram to be a word whose characters can be rearranged to create another word. Given two strings, we want to know the minimum number of characters already in either string that we must modify to make the two string anagrams; if it's not possible to make the two string anagrams, we consider this number to be -1. For example:

  • tea and ate are anagrams, so we would need to modify a minimum of 0 characters.
  • tea and toe are not anagrams, but we can modify a minimum of 1 character in either string to make them anagrams.
  • act and acts are not anagrams and cannot be converted to anagrams because they contain different numbers of characters, so the minimum number of characters to modify is -1.

The function must return an array of integers where each element i denotes the minimum number of characters you must modify to make 'a' and 'b' anagrams, if it's not possible to modify the existing characters in 'a' and 'b' to make them anagrams element i should be -1 instead.

Note: You can't delete or append the quantity of characters.

Example:

5 a jk abb mn abc 5 bb kj bbc op def

playing-with-anagrams's People

Contributors

lucasoscarsimon avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.