Skip to main content

All Questions

Filter by
Sorted by
Tagged with
5 votes
2 answers
612 views

Leet Code 139 (Word Break) using a trie with recursion

I was attempting to solve LeetCode 139 - Word Break Given a string s and a dictionary of strings wordDict, return ...
Shawn Frank's user avatar
1 vote
1 answer
323 views

Finding the winner of a tic-tac-toe game in Swift

Working on the problem Find Winner on a Tic Tac Toe Game, I took several hours longer than an artificial time constraint the site had for mock interview purposes. This leads me to wonder if my ...
Curious's user avatar
  • 113
1 vote
1 answer
222 views

Minimum Window Substring in Swift exceeds LeetCode runtime check

This is a popular question on LeetCode: 76. Minimum Window Substring Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in ...
Shawn Frank's user avatar
2 votes
1 answer
3k views

Dynamic Array Problem (Hacker rank)

I am trying to solve the Dynamic Array problem on HackerRank: Create a list, seqList, of N empty sequences, where each sequence is indexed from 0 to N-1. The elements within each of the N ...
Siddharth Kumar's user avatar
3 votes
1 answer
537 views

Minimum window substring - LeetCode challenge

Below is my code for the “Minimum Window Substring” LeetCode problem in Swift: Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(...
Vaibhav Singh's user avatar
4 votes
1 answer
1k views

Jumping on the clouds

I have started the Hackerrank interview preparation kit. The first problem I have solved with Swift is as follows: Emma is playing a new mobile game that starts with consecutively numbered clouds. ...
Onur Tuna's user avatar
  • 151
8 votes
3 answers
1k views

Leetcode 38: The “count-and-say” sequence

38. Count and Say The count-and-say sequence is the sequence of integers with the first five terms as following: ...
dengApro's user avatar
  • 421
5 votes
1 answer
575 views

Leetcode 102: Binary tree level-order traversal in Swift

102. Binary Tree Level Order Traversal Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example: Given binary ...
dengApro's user avatar
  • 421
1 vote
2 answers
670 views

Minimum Area Rectangle in Swift

This is my solution to LeetCode – Minimum Area Rectangle in Swift 939. Minimum Area Rectangle Given a set of points in the xy-plane, determine the minimum area of a rectangle formed from these points,...
dengApro's user avatar
  • 421
2 votes
2 answers
1k views

Valid Sudoku in Swift

This is my solution to LeetCode – Valid Sudoku in Swift. ...
dengApro's user avatar
  • 421
7 votes
1 answer
649 views

Swiftly counting rooms in a floor plan

Inspired by recent questions about counting the rooms in a floor plan (1, 2, 3), here is my attempt to solve the problem with a Swift program. The problem (from “Counting Rooms” on CSES) is: You ...
Martin R's user avatar
  • 24k
1 vote
1 answer
2k views

Numbers as Strings Multiplication Function in Swift

I was solving a problem 20, Factorial Digit Sum, on Project Euler. Factorial Digits Sum \$n!\$ means \$n \cdot (n − 1) \cdot \ldots \cdot 3 \cdot 2 \cdot 1\$ For example, \$10! = 10 \cdot ...
Noah Wilder's user avatar
2 votes
1 answer
478 views

HackerRank Caesar Cipher, not using map, filter, reduce, regex

Julius Caesar protected his confidential information by encrypting it in a cipher. Caesar's cipher rotated every letter in a string by a fixed number, K, making it ...
Nazmul Hasan's user avatar
4 votes
1 answer
856 views

Checking whether strings are permutations of each other in Swift

I'm solving this problem on Hacker Earth, just for practice. The exercise is to determine whether two given equal-length strings are permutations of each other. Except for this one test case, which ...
kanadenipun's user avatar
3 votes
1 answer
166 views

Project Euler problem #14 (longest Collatz chain) in Swift

This is my Swift code for finding the starting number, under one million, which produces the longest collatz chain. ...
mobs_boss's user avatar
  • 131

15 30 50 per page