I received an email inviting me to solve the Classes and Objects challenge at HackerRank. If interested please take a look at the requirements and give it a try before reading my solution.
The requirements call for the design of a class with two methods. One of them reads grades from standard input while the other computes the total score for a set of five grades. Continue reading “Classes and Objects”
I received an email from HackerRank inviting me to solve the Class challenge. I like the reminder feature because I do not have to think about challenges during the workday. They just pop into my in box and I just have to pick a time to solve them. Continue reading “Class”
Ditto. This post covers the continuation of the original proposed (by me) challenge to HackerRank. Seems that I made the mistake to generate the post New, Duplicate or in Segment – Part 2 which describes this challenge. As you can verify I did not suggested a solution. Apparently that was enough to disqualify this entry. Next time I come up with a proposed challenge will not post a thing about it. Continue reading “New, Duplicate or in Segment – Part 4”
I received a message from HackerRank indicating that they would not be able to use the New, Duplicate or in Segment proposed (by me) challenge because I had already made a post in my blog. I thought it would be fine if I did not describe a possible solution. I guess I was wrong.
Within the specified range label each received integer as “New” if the integer is being processed for the first time, “Duplicate” is the integer is not in a segment but has been processed before or “In segment” if the integer is part of a segment of two or more integers. Continue reading “New, Duplicate on in Segment – Part 3”
I received a message from HackerRank to solve the Vector-Sort challenge. The requirements call to instantiate a vector of the desired size. Populate and then sort the vector. Once sorted the values in the vector need to be displayed. Continue reading “Vector-Sort”
Last Friday GC (software engineer) on his way to work was listening to a podcast. During the program a video “Jiro Dreams of Sushi” was recommended for the audience. When GC arrived at work he sent me an email suggesting the documentary. Continue reading “Jiro Dreams of Sushi”
I decided to complete the continuation of the HackerRank challenge that I put together. This is a follow up on my post New, Duplicate or in Segment. Regarding the previous challenge, I need to get back to HackerRank. A member of their team sent me an invitation on Google Hangouts so the ball is in my court. Have been very busy this week so will be calling them over the weekend. If that plan does not work, I will try Monday. I believe there are several hours difference between us.
I am not going to provide a solution for this challenge but will provide the requirements at this time. Continue reading “New, Duplicate or in Sequence – Part 2”
Guava by Google contains the BiMap class which implements a bi-directional map. On many occasions I have been using a Map and had the need to invert it to use the values as keys. It is doable but somewhat cumbersome. You can always use two maps (key -> value and value -> key) but on many occasions you may run into the issue that the values are duplicated and the second map will have to deal with duplicate keys. This elegant class available in Guava may be of assistance. Continue reading “Guava -BiMap”
Not to be confused with the fruit, Guava is an open source, Java based library developed by Google. It provides utility methods for collections, caching, primitives support, concurrency, common annotations, string processing, I/O, and validations.
I have been experimenting and using the Google Guava library for a few months. Most of features are quite nice and useful (e.g., Multimaps). In this post I show how easy it is interact with multimaps. Continue reading “Guava – Multimap”
I took a look at the StringStream HackerRank challenge. There are two items that one needs to deal with. The first is to parse the coma separated string of integers after it has been assigned to a string stream as suggested by the challenge. Of course one could solve this challenge just parsing the string directly. The second task is to allocate a vector in which to return the integers. At first I just allocated an empty array which I resized each time a new integer had to be inserted. In my final approach I just determined the number of integers by counting the ‘,’s in the string. Continue reading “StringStream”