|Felix Halim .NET|
University Experience IOI 2002 Yong In, Korea ACM ICPC Regional Manila 2003 ACM ICPC Regional Manila 2004 ACM ICPC Regional Manila 2005 ACM ICPC Regional Kaohsiung 2006 ACM ICPC Regional Singapore 2007 ACM ICPC Regional Jakarta 2008 (ext) ACM ICPC Regional Jakarta 2009 (ext) ACM ICPC Regional Jakarta 2010 ACM ICPC Regional Jakarta 2012 - Problem H ACM ICPC Regional Jakarta 2013 - Problem J (new!) ACM ICPC World Final Tokyo 2007 Google India Code Jam 2005 Google India Code Jam 2006 Indonesia National Contest 2007 Indonesia National Contest 2008 Indonesia National Contest 2010 Facebook Hacker Cup 2011
String S is a SP-string if some non-empty prefix of S is also a suffix of S. The prefix (the suffix) can't be the whole string. For example, strings "AA" and "ABCABC" are SP-strings, but strings "AB", "ABCB" are not. String S is a N-string if it satisfies the following conditions:
For example, "ABBA" is a 2-string because it contains only the first 2 letters of the alphabet, and both "ABBAA" and "ABBAB" are SP-strings. There is an infinite number of N-strings, but in this problem we will consider only N-strings of minimal length (that is, N-strings of length L such that no N-string of length less than L exists).
You will be given two ints - N and K. Build all the shortest possible N-strings and sort them alphabetically. Return the substring of the K-th string from index leftIdx (inclusive) to index rightIdx (exclusive). Return "" if the K-th string contains less than rightIdx characters or the K-th string doesn't exist.
Class: InterestingStrings Method: findSubstring Parameters: int, int, int, int Returns: string Method signature: string findSubstring(int N, int K, int leftIdx, int rightIdx) (be sure your method is public)
0) 1 0 3 Returns: "BAB" 1) 1 0 0 1 Returns: "A" 2) 2 0 1 3 Returns: "BA" 3) 4 0 7 9 Returns: "DA" 4) 3 1 0 7 Returns: "ACABACA" 5) 5 1000 99999999 100000000 Returns: ""
This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2003, TopCoder, Inc. All rights reserved.
Google India Code Jam 2006 - Table of Contents