Skip to main content

All Questions

Tagged with
-2 votes
1 answer
192 views

Design an algorithm to predict words based on a skeleton from a given dictionary

The model I'm building first selects a secret word at random from a list. The model which uses an API then returns a row of underscores (space separated)—one for each letter in the secret word—and ...
driver's user avatar
  • 222
1 vote
3 answers
234 views

Convert camelCase function name to snake_case

I have the following code: ...
TomS's user avatar
  • 11
2 votes
1 answer
83 views

Optimising function to strip honorifics from names

Problem I have a list of around ~1000 honorifics, see below for a sample. Given an input string of a name, for example ...
Ian's user avatar
  • 233
5 votes
1 answer
595 views

Lingo (word-game) guessing strategy

My friend and I are kind of noobs in Python and are looking for ways to improve. We thought it would be cool if we could get some feedback on the following code. It is for a game named "Lingo&...
SelfLearnedNoob's user avatar
10 votes
4 answers
3k views

First non-repeating Character, with a single loop in Python

I recently tried to solve the first non-repeating character problem. Please tell me if my solution is valid. I'm aiming for O(n) with a single loop. My thinking is, it would be easy to tell you what ...
zing's user avatar
  • 203
1 vote
1 answer
542 views

Finding longest word in a sentence

A problem from Coderbyte. Find the longest word in a sentence after removing the punctuations and if two or more words are of same length return the first word Below is my solution: ...
katty's user avatar
  • 615
7 votes
2 answers
815 views

Number of occurrences of strings in array

This is a Hackerrank problem (https://www.hackerrank.com/challenges/sparse-arrays/problem). We're given an array of strings and an array of queries, and have to return an array of the number of ...
jeremy radcliff's user avatar
2 votes
1 answer
747 views

Strong Password Checker (Python)

Problem Write a program to return True, if a string is a strong password. A password is considered strong if below conditions are all met: It should have at least ...
Emma's user avatar
  • 3,592
1 vote
1 answer
367 views

Capitalize the First Letter of Words in a String (JavaScript, Python)

Problem Write a function that accepts a string, capitalizes the first letter of each word in the string, and returns the capitalized string. Examples ...
Emma's user avatar
  • 3,592
1 vote
1 answer
162 views

Anagram (Python, JavaScript)

Problem Write a function to check whether two given strings are anagram of each other or not. An anagram of a string is a string that contains same characters ([A-Za-z0-9]) and the order of ...
Emma's user avatar
  • 3,592
5 votes
3 answers
1k views

LeetCode 65: Valid Number (Python)

Problem Validate if a given string can be interpreted as a decimal or scientific number. Some examples: ...
Emma's user avatar
  • 3,592
3 votes
2 answers
1k views

Palindrome and Reverse a String Problems (JavaScript, Python)

Problem 1 Given a string, the task is to reverse the string and return a reversed string. Problem 2 Given a string, return true if the string is a palindrome or false if it is not. Code Just for ...
Emma's user avatar
  • 3,592
2 votes
0 answers
288 views

Split a string into valid words

I am trying to solve this LeetCode question: Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, add spaces in s to construct a sentence where each word is ...
nz_21's user avatar
  • 1,051
5 votes
2 answers
313 views

Leetcode longest substring with no duplicates

...
neet's user avatar
  • 91
1 vote
3 answers
62 views

`set_includes` (string subsequence-containment) in Python 2

I've implemented C++'s std::includes algorithm in Python, so that I can use it to efficiently implement a Scrabble "can I make this word" function: ...
Quuxplusone's user avatar
  • 19.5k

15 30 50 per page
1
2 3 4 5