Problem
Leaderboard
🎁 May Giveaway
This May, you have the opportunity to hone your skills and win the Macbook Air, Sony WH-1000XM4 headphones, $50 gift card and much more.
🎮 How to Play
Complete Educative’s daily coding challenge all month.
Choose your preferred programming language before you start, you can switch it anytime, even mid-problem.
Be mindful of your attempts, you only get a limited number, so make each one count.
Keep your streak alive, the longer it runs, the more raffle entry tickets you rack up.
Earn tickets and increase your chances of winning the draw.
🎟️ How to earn Tickets
ActionTickets Earned
Complete Daily Challenge
+1
10-Day Streak
+10
20-Day Streak
+20
30-Day Streak
+30
LinkedIn post with #30DaysofCode Everyday (and tag Educative)
+2 per post
Most-Liked Post Overall
+20
Top of Leaderboard
+50
Leaderboard: 2nd place
+30
Leaderboard: 3rd place
+20

Problem: Word Pattern

Statement

You are given a pattern and a string, s. You need to determine whether the string s follows the same pattern.

A string s is said to follow a pattern if a bijection exists between a character in the pattern and a non-empty word in s.

  • Each character in the pattern must map to exactly one unique word in s.

  • Each word in s must map to exactly one unique character in pattern.

  • No two characters map to the same word, and no two words map to the same character.

Constraints:

  • 1≤1 \leq pattern.length ≤100\leq 100

  • The pattern contains only lowercase English letters.

  • 1≤1 \leq s.length ≤1000\leq 1000

  • s contains only lowercase English letters and spaces ' '.

  • s does not contain any leading or trailing spaces.

  • A single space separates all the words in s.

Problem
Leaderboard
🎁 May Giveaway
This May, you have the opportunity to hone your skills and win the Macbook Air, Sony WH-1000XM4 headphones, $50 gift card and much more.
🎮 How to Play
Complete Educative’s daily coding challenge all month.
Choose your preferred programming language before you start, you can switch it anytime, even mid-problem.
Be mindful of your attempts, you only get a limited number, so make each one count.
Keep your streak alive, the longer it runs, the more raffle entry tickets you rack up.
Earn tickets and increase your chances of winning the draw.
🎟️ How to earn Tickets
ActionTickets Earned
Complete Daily Challenge
+1
10-Day Streak
+10
20-Day Streak
+20
30-Day Streak
+30
LinkedIn post with #30DaysofCode Everyday (and tag Educative)
+2 per post
Most-Liked Post Overall
+20
Top of Leaderboard
+50
Leaderboard: 2nd place
+30
Leaderboard: 3rd place
+20

Problem: Word Pattern

Statement

You are given a pattern and a string, s. You need to determine whether the string s follows the same pattern.

A string s is said to follow a pattern if a bijection exists between a character in the pattern and a non-empty word in s.

  • Each character in the pattern must map to exactly one unique word in s.

  • Each word in s must map to exactly one unique character in pattern.

  • No two characters map to the same word, and no two words map to the same character.

Constraints:

  • 1≤1 \leq pattern.length ≤100\leq 100

  • The pattern contains only lowercase English letters.

  • 1≤1 \leq s.length ≤1000\leq 1000

  • s contains only lowercase English letters and spaces ' '.

  • s does not contain any leading or trailing spaces.

  • A single space separates all the words in s.