Leetcode 2. Add Two Numbers – my solution

Description You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list. You may assume the…

KATTIS – Delimiter Soup

Problem Whenever a programmer starts to learn a Lisp, they think that there are too many parentheses in it. Sophia thinks there are too few, so she is making a programming language with only parentheses. To spice it up a…

Python exercise 23: Two sum

Question Given an array of integers nums and an integer target, return _indices of the two numbers such that they add up to MARKDOWN_HASH42aefbae01d2dfd981f7da7d823d689eMARKDOWNHASH. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer…

Python exercise 22: ransomnote

Question Given two strings ransomNote and magazine, return true if ransomNote_can be constructed by using the letters from_ magazine and false otherwise. Each letter in magazine can only be used once in ransomNote. Example Example 1: Input: ransomNote = "a", magazine = "b" Output: false Example 2: Input: ransomNote = "aa", magazine…

Python Exercise 20:Find the pattern

Question Given a dictionary containing up to six phrases, return a list containing the matching phrases according to the given string (p). Ignore any digit that is placed after or before the given string. Whether the first letter is capitalized or…

Python exercise 18:Sales Season

Question A retailer is having a store-wide "buy 2, get 1 free" sale. For legal reasons, they can’t charge their customers $0 for an article so a discount is applied to all products instead. — Create a function that takes…