Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
May 14, 2020 03:08 pm GMT

Daily Challenge 243 - Redacted!

The first document has parts redacted, and the other one doesn't. But the clean document might be a fake! You need to compare the two documents and decide if it is possible they are the same or not. Return true if the two documents are possibly the same. Return false otherwise.

Rules

  • Each document is made of any visible characters, spaces, punctuation, and newlines \n
  • Any character might be redacted (except \n)
  • The redaction character is X
  • The redacted document is always the first one

Example

doc1 = "TOP SECRET:\nThe missile launch code for Sunday XXXXXXXXXX is:\nXXXXXXXXXXXXXXXXX"
doc2 = "TOP SECRET:\nThe missile launch code for Sunday 5th August is:\n7-ZERO-8X-ALPHA-1"
Documents look the same, therefore true.

Tests

doc1 = "The name of the mole is Professor XXXXX"
doc2 = "The name of the mole is Professor Dinglemouse"

doc1 = "XXXXXXXX XXXXXXX XXXXXXXXXXXXXXXXXXX\nXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX XXXXXXXXXXXXX XXXXX"
doc2 = "Area-51. Medical Report. 23/Oct/1969\nE.T. subject 4 was given an asprin after reporting sick for duty today"

Good luck!

This challenge comes from dinglemouse on CodeWars. Thank you to CodeWars, who has licensed redistribution of this challenge under the 2-Clause BSD License!

Want to propose a challenge idea for a future post? Email [email protected] with your suggestions!


Original Link: https://dev.to/thepracticaldev/daily-challenge-243-redacted-4fd

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To