GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — leetcode/problems/find-words-that-can-be-formed-by-characters at master · ecgan/leetcode

Expand file tree

/

find-words-that-can-be-formed-by-characters

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

find-words-that-can-be-formed-by-characters

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
README.md
README.md
 
 
solution.js
solution.js
 
 
solution.test.js
solution.test.js
 
 

README.md

Outline

Find Words That Can Be Formed by Characters

LeetCode #: 1160

Difficulty: Easy

Topics: Array, hash table.

Explanation

This solution makes use of JavaScript Map objects as hashtable to store the counts of characters.

Complexity Analysis

Assume m is the total number of characters in all the word in words, and n is the total number of characters in chars.

Time complexity: O(m+n)

In the worst case, the solution will go through all the m and n characters once.

Space complexity: O(m+n)

In the worst case, the size of the hash tables would be m and n.

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.