## Tag Archives: implementation

### Leetcode 30 – Substring with concatenation of all words

Source: https://leetcode.com/problems/substring-with-concatenation-of-all-words/ Problem statement You are given a string s and an array of strings words. All the strings of words are of the same length. A concatenated substring in s is a substring that contains all the strings of any permutation of words concatenated. For example, if words = [“ab”,”cd”,”ef”], then “abcdef”, “abefcd”, “cdabef”,…

### Educational Codeforces Round 129 – Problem C

You are given two arrays a and b, both consisting of n integers. In one move, you can choose two indices i and j (1≤i,j≤n; i≠j) and swap ai with aj and bi with bj. You have to perform the swap in both arrays. You are allowed to perform at most 104 moves (possibly, zero)….

### Educational Codeforces Round 129 – Problem B

Monocarp has just learned a new card trick, and can’t wait to present it to you. He shows you the entire deck of n cards. You see that the values of cards from the topmost to the bottommost are integers a1,a2,…,an, and all values are different. Then he asks you to shuffle the deck m…

### Educational Codeforces Round 129 – Problem A

Alice and Bob play a game. Alice has n cards, the i-th of them has the integer ai written on it. Bob has m cards, the j-th of them has the integer bj written on it. On the first turn of the game, the first player chooses one of his/her cards and puts it on…

### Codeforces Round #793 – Problem C

C. LIS or Reverse LIS? time limit per test: 1 second memory limit per test: 256 megabytes input: standard input output: standard output You are given an array a of n positive integers. Let LIS(a) denote the length of longest strictly increasing subsequence of a. For example, LIS([2,1,1,3]) = 2. LIS([3,5,10,20]) = 4. LIS([3,1,2,4]) =…

### Codeforces Round #778 – Problem B

B. Prefix Removals time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input output: standard output You are given a string s consisting of lowercase letters of the English alphabet. You must perform the following algorithm on s: Let x be the length of the longest prefix of s which occurs somewhere else in s as a contiguous substring…

### Google KickStart – Round A – Problem 1

Barbara is a speed typer. In order to check her typing speed, she performs a speed test. She is given a string I that she is supposed to type. While Barbara is typing, she may make some mistakes, such as pressing the wrong key. As her typing speed is important to her, she does not want to…

### Codeforces Round #777 Div 2 – Problem C

Original problem statement taken from this link. Madoka and the Childish Pranks time limit per test: 1 second memory limit per test: 256 megabytes input: standard input output: standard output Madoka as a child was an extremely capricious girl, and one of her favorite pranks was drawing on her wall. According to Madoka’s memories, the…