Code Monkey home page Code Monkey logo

Comments (6)

saichandernagamalla avatar saichandernagamalla commented on August 24, 2024

@priyamm
your solution has complexity of nlogn which can be optimized further to n. If you are ok, would like to contribute.

from java-jet.

priyamm avatar priyamm commented on August 24, 2024

@saichandernagamalla Whats would be your logic assuming no extra space taken?

from java-jet.

saichandernagamalla avatar saichandernagamalla commented on August 24, 2024

@priyamm raised a PR #66 . Time complexity = n, Space complexity =n.
My implementation has a map which stores count of characters in str1. While traversing str2, I will be removing characters of str2 from map count. Finally, count of each character in map should be zero to say it an anagram, else not an anagram.
I believe that importance of time complexity > space complexity. As current day devices has much RAM space, so time complexity plays major role.
Correct me if i'm missing anywhere.

from java-jet.

priyamm avatar priyamm commented on August 24, 2024

@saichandernagamalla Modern day devices are quite faster too, Octa-core processors with parallel and multithreading can easily beat out the speed. It depends upon the circumstances whether we should be creating more variables and handle memory leaks if present.

For interview, it depends upon the interviewer which complexity (s)he choses.

from java-jet.

priyamm avatar priyamm commented on August 24, 2024

@ShivangiSingh17 When are you planning to merge the open PRs?

from java-jet.

ShivangiSingh17 avatar ShivangiSingh17 commented on August 24, 2024

@priyamm I will merge the PRs soon. Thanks for your concern

from java-jet.

Related Issues (20)

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.