-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
12163ae
commit 602798e
Showing
14 changed files
with
316 additions
and
444 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 0 additions & 62 deletions
62
src/modules/hackathon/CompetitionSection/Problems/ProblemData/1_21_ATimesBPlusC.ts
This file was deleted.
Oops, something went wrong.
114 changes: 114 additions & 0 deletions
114
src/modules/hackathon/CompetitionSection/Problems/ProblemData/1_27_StringSimilarity.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
export const PROBLEM_STRING_SIMILARITY_MARKDOWN = ` | ||
# StringSimilarity | ||
### *Problem ID: 27* | ||
| ||
A binary string is a string where each character is either $0$ or $1$. Two binary strings $a$ and $b$ of equal length are similar, if they have the same character in some position (there exists an integer $i$ such that $a_i=b_i$). For example: | ||
| ||
* \`10010\` and \`01111\` are similar (they have the same character in position 4); | ||
* \`10010\` and \`11111\` are similar; | ||
* \`111\` and \`111\` are similar; | ||
* \`0110\` and \`1001\` are not similar. | ||
| ||
You are given an integer $n$ and a binary string s consisting of $2n−1$ characters. Let's denote $s[l..r]$ as the contiguous substring of s starting with l-th character and ending with r-th character (in other words, $s[l..r]=s_ls_{l+1}s_{l+2}...s_r$). | ||
You have to construct a binary string $w$ of length $n$ which is similar to all of the following strings: $s[1..n], s[2..n+1], s[3..n+2], ..., s[n..2n−1]$. | ||
| ||
## Implementation details: | ||
| ||
Your smart contract needs to implement the following function(s): | ||
\`\`\`js | ||
function solve(string memory s) external returns (string memory); | ||
\`\`\` | ||
- $s$: One string --- the binary string $s$ of length $2n−1$. Each character $s_i$ is either \`0\` or \`1\`. | ||
- This function need to return one string --- the corresponding binary string $w$ of length $n$. | ||
- This function will be called exactly once with gas limit of $1\,000\,000$. | ||
## Constraints: | ||
- $1$ ≤ $|s|$ ≤ $1000$ | ||
| ||
## Examples: | ||
| ||
### Example 1: | ||
| ||
Consider the following function call: | ||
\`\`\`js | ||
solve(1) | ||
\`\`\` | ||
* $1$ is similar to $s[1..1]=1$. | ||
The function therefore should return $1$. | ||
| ||
### Example 2: | ||
| ||
Consider the following function call: | ||
\`\`\`js | ||
solve(00000) | ||
\`\`\` | ||
* $000$ is similar to $s[1..3]=000$; | ||
* $000$ is similar to $s[2..4]=000$; | ||
* $000$ is similar to $s[3..5]=000$. | ||
The function therefore should return $000$. | ||
| ||
### Example 3: | ||
| ||
Consider the following function call: | ||
\`\`\`js | ||
solve(1110000) | ||
\`\`\` | ||
* **10**1**0** is similar to $s[1..4]$=**1**1**10**; | ||
* **1**01**0** is similar to $s[2..5]$=**1**10**0**; | ||
* **10**1**0** is similar to $s[3..6]$=**10**0**0**; | ||
* 1**0**1**0** is similar to $s[4..7]$=0**0**0**0**. | ||
The function therefore should return $1010$. | ||
| ||
### Example 4: | ||
| ||
Consider the following function call: | ||
\`\`\`js | ||
solve(101) | ||
\`\`\` | ||
&textbf; | ||
* 0**0** is similar to $s[1..2]$=1**0**; | ||
* **0**0 is similar to $s[2..3]$=**0**1. | ||
The function therefore should return $000$. | ||
`; |
63 changes: 0 additions & 63 deletions
63
src/modules/hackathon/CompetitionSection/Problems/ProblemData/2_22_RepeatModulo.ts
This file was deleted.
Oops, something went wrong.
90 changes: 90 additions & 0 deletions
90
src/modules/hackathon/CompetitionSection/Problems/ProblemData/2_28_FavoriteNumbers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
export const PROBLEM_FAVORITE_NUMBERS_MARKDOWN = ` | ||
# Favorite Numbers | ||
### *Problem ID: 28* | ||
| ||
Ringo loves the integer $200$. Solve the problem below for him. | ||
Given a sequence $A$ of $N$ positive integers, find the pair of integers $(i,j)$ satisfying all of the following conditions: | ||
* $1$ ≤ $i < j$ ≤ $N$ | ||
* $A_i - A_j$ is a multiple of $200$. | ||
| ||
## Implementation details: | ||
| ||
Your smart contract needs to implement the following function(s): | ||
\`\`\`js | ||
function solve(int256[] calldata a) external returns (uint256); | ||
\`\`\` | ||
- $a$: An array of length $n$. | ||
- This function need to return the number of pair of integers satisfying the problem. | ||
- This function will be called exactly once with gas limit of $1\,000\,000$. | ||
| ||
## Constraints: | ||
- $2$ ≤ $N$ ≤ $2$ × $10^3$ | ||
- $1$ ≤ $A_i$ ≤ $10^9$ | ||
| ||
## Examples: | ||
| ||
### Example 1: | ||
| ||
Consider the following function call: | ||
\`\`\`js | ||
solve([123, 223, 123, 523, 200, 2000]) | ||
\`\`\` | ||
For example, for $(i,j)=(1,3)$, $A_1 - A_3 =0$ is a multiple of 200. | ||
We have four pairs satisfying the conditions: $(i,j)=(1,3),(1,4),(3,4),(5,6)$. | ||
The function therefore should return $4$. | ||
| ||
### Example 2: | ||
| ||
Consider the following function call: | ||
\`\`\`js | ||
solve([1, 2, 3, 4, 5]) | ||
\`\`\` | ||
There is no pair satisfying the conditions. | ||
The function therefore should return $0$. | ||
| ||
### Example 3: | ||
| ||
Consider the following function call: | ||
\`\`\`js | ||
solve([199, 100, 200, 400, 300, 500, 600, 200]) | ||
\`\`\` | ||
The function therefore should return $9$. | ||
`; |
Oops, something went wrong.