Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

anagram

Using Python, find anagrams for a list of words

January 2, 2024 by Tarik

In order to do this for 2 strings you can do this: def isAnagram(str1, str2): str1_list = list(str1) str1_list.sort() str2_list = list(str2) str2_list.sort() return (str1_list == str2_list) As for the iteration on the list, it is pretty straight forward

Categories python Tags anagram, python Leave a comment

Finding anagrams for a given word

May 7, 2023 by Tarik

Example algorithm: Open dictionary Create empty hashmap H For each word in dictionary: Create a key that is the word’s letters sorted alphabetically (and forced to one case) Add the word to the list of words accessed by the hash key in H To check for all anagrams of a given word: Create a key … Read more

Categories algorithm Tags algorithm, anagram, data-structures, language-agnostic Leave a comment

How to check if two words are anagrams

May 4, 2023 by Tarik

Two words are anagrams of each other if they contain the same number of characters and the same characters. You should only need to sort the characters in lexicographic order, and determine if all the characters in one string are equal to and in the same order as all of the characters in the other … Read more

Categories java Tags algorithm, anagram, java, string Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa