eProblem
By admin on Apr 24, 2007 | In Art | Send feedback »
This is a coding problem I was assigned for an interview a couple years ago. I didn't get the job ... and I'm glad for it.
Given an alphanumeric start point and an alphanumeric end point, generate a list of all alphanumeric codes between those two points, inclusive.
Example: Given B4Y and B53, you'll have generated B4Y, B4Z, B50, B51, B52, and B53. The range is 0-9, A-Z.
These sequences will be read from a data file as specified on the command line, each line will contain a mask, start, and end point.
Example: R##2#G B4Y B53Using the mask, generate new codes by replacing the hash characters from mask with the characters from the previously generated codes.
Example: Given a mask of R##2#G, and a value of B4Y, the new value is RB42YG.Create SQL calls that will insert them into a table called 'reg_codes', in the column 'code' to a text file which is specified on the command line.
Any codes containing two identical characters in succession is invalid, unless they're followed by an R or a 2.
(\.)\1(?:[^R2]) = bad code.Print a list of characters that caused invalid codes, and those codes, to a file called "invalid.dat"
Show some sort of status information to keep the user informed of the progress of the tasks.
Read a server name, username, and password from server.dat. Upload the dumped data file as a tarball to the ftp server.
Code must run cleanly under strict & warnings.
input.txt:
Mask, start , End
7##22##8 PF00 PFA9
X#Y#Z 09 16
###R 3Sx 3RL
M##2#Z 09D Xl16
-----
No feedback yet
Leave a comment
| « Army to censor soldier's blogs | 10. "RE: CB 360" » |