Problem Statement
Given a string S, a 737-triple in S is a triple (i,j,k) such that:
- i, j, k are valid indices into S such that i < j < k
- S[i] = '7', S[j] = '3', and S[k] = '7'.
You are given an int X. Your task is to generate and return any string S such that:
- The length of S is between 1 and 373, inclusive.
- The string S contains only characters '3' and '7'.
- The number of 737-triples in S is exactly X.
You may assume that for the given constraints a solution always exists.
Definition
- Class:
- Make737Hard
- Method:
- make
- Parameters:
- int
- Returns:
- String
- Method signature:
- String make(int X)
- (be sure your method is public)
Constraints
- X will be between 0 and 1,737,373, inclusive.
Examples
1
Returns: "737"
8
Returns: "773377"
0
Returns: "777333"
4
Returns: "73737"