Skip to main content

All Questions

5 votes
3 answers
957 views

LeetCode 678: Valid Parenthesis String, Recursion memoization to DP

How can the following recursion + memoization code be converted into a tabulation format dynamic programming solution? The code is working, but I want to improve it. The challenge I am facing is ...
Elias El hachem's user avatar
2 votes
2 answers
250 views

Generate the number of partitions of each integer

I've coded a program that calculates the number of partitions of n into at least two distinct parts, and is relatively quick too (about N^1.5 complexity). For input 30 000 it takes roughly 4 seconds. ...
svok's user avatar
  • 21
1 vote
1 answer
636 views

CodeChef Matches challenge

I am solving some problems from CodeChef but I am stuck on the Matches problem: Ari and Rich are playing a pretty confusing game. Here are the rules of the game: The game is played with ...
ADITYA JOSHI's user avatar
2 votes
3 answers
408 views

List of Happy Numbers in scala

Definition of Happy numbers taken from Wikipedia. A happy number is defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits ...
vikrant's user avatar
  • 405
7 votes
2 answers
749 views

Project Euler 357 prime number generator in Python 3

I'm brute forcing the Project Euler 357 since no better algorithm comes to my mind. The challenge asks: Find the sum of all positive integers n not exceeding 108 such that for every divisor d of n, ...
Bor's user avatar
  • 507
2 votes
0 answers
611 views

Leetcode 10: Regular Expression Matching

Problem statement Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or more of the preceding element. The matching ...
Jianmin Chen's user avatar
  • 2,416
3 votes
1 answer
4k views

Google Foobar Level 3 - Lucky Triples (Find the Access Codes)

I have been working on this problem for 3 days now. I wrote a piece of java code that works perfectly on my machine testing in Eclipse, but when I put it in Foobar, it either returns "Error(400) Bad ...
user avatar