I have a list of integer numbers. Determine the sequence of numbers with the highest total in the list. Numbers may be positive or negative. Output the start and end positions and the total.
Category / Interview
Technical Interview Question #2
I have an array. I need the array’s element order randomized.
So, if I have an array like this:
a[0] = "abc"
a[1] = "def"
a[2] = "ghi"
a[3] = "jkl"
It might be randomized like this:
a[0] = "jkl"
a[1] = "def"
a[2] = "abc"
a[3] = "ghi"
You’re provided with a function which returns a random number between 0 and N, where N is the number you provide as a parameter.
As always, your solution should execute quickly and be efficient.
Technical Interview Question #1
I need you to build a fuzzy clock. When asked by others, "What time is it?" do you answer precisely, "7:34 AM"? I don’t. Many would instead answer, "About seven-thirty". Write the code necessary to provide the fuzzy clock response. Consider a few of the valid responses to be, "quarter-past", "half-past", "quarter-till", "about N-o’clock", etc. Be creative.
Write a function which returns a string with the properly formatted current fuzzy time. Your function is provided the current Date and Time (in the appropriate format for your environment and language choice).
Technical Interview Question Series Starting
I’m going to begin posting weekly a technical interview question. Generally, each question should be solvable in less than 30 minutes time. Often, much less. Some amount of coding is typically necessary to solve the problem (either actual code or pseudo-code), but occasionally, just a plan or discussion-style response is expected.
I’d consider these questions to be of the Microsoft technical interview style questions (having worked there, I both was interviewed and interviewed others, so I have some experience with them). If nothing else, you might find them interesting problems to think about for a couple of moments during your day. That’s my primary reason for posting them: a little brain teaser during your day.
I’d really like to see who can answer them first, BUT, given the nature of the Internet and time zones — it’s not really practical. If you have an answer that you’d like to show off and you have a blog, put the answer on your blog, and link to the question and post a comment (if trackbacks aren’t working). Otherwise, feel free to post the answer in the comment. There often will be more than one answer!
Code it in any language you’re comfortable with! There’s no right or wrong language for these questions (unlike many interviews at Microsoft that have historically considered C/C++ the "only" language you should use).
By the way, a long answer isn’t necessarily a "wrong" answer, but it’s probably not the best answer. :)
(I’ll go as long as I can with the series … if you have questions you’d like to see added, feel free to contact me using the contact form in the header, or send an e-mail to coder at this website).