Was talking with a software developer regarding how to determining the max path of a pyramid. We discussed a solution but it is nice to see it come to live.
The following figure illustrates the structure of the pyramid:
The requirements are that the height be in the range 1 <= height <= 25. The tree is complete. There are no missing nodes. That implies that the base contains leaf nodes (no children). The values for the nodes should arbitrarily be in the range 1 <= val <= 100. Continue reading “Pyramid Max Path”
I randomly chose to solve the Word Search challenge at LeetCode found at the following URL: https://leetcode.com/problems/word-search/
Following are the console screen captures from the Eclipse IDE for the three sample cases using the same character array: Continue reading “Word Search”
For the past few months I had been working attempting to solve a challenge per day on HackerRank. I like that site. A couple weeks ago I was introduced to LeetCode. Challenges seem to be more intense and requirements seem to be vaguer. Knowing this, one needs to think and plan the approach / algorithm with greater care and expect to fail unit tests that one would not think off. I just finished a challenge and decided to post in this blog my approach to solving it. Continue reading “Fraction Recurring Decimal”
Here is a simple task. Given an array of 10,000 random unsigned short integers (16-bit values) count the number of bits set to one (1). In the following example we have an array of two (2) unsigned shorts:
The first number 41,344 contains 4 ones and the second value 58,520 contains 7 ones for a total of (4 + 7) = 11 ones. Continue reading “Count Ones”
UPDATE – I received a separate email message from a fellow software developer. He is interested in providing a text file and creating a new test method to process it. The idea is to provide a text file with the number of triangles to test followed by the triangle sides and associated type so we would be able to test them all at once. This new test was NOT part of the initial HackerRank challenge.
UPDATE – I received an email message from a fellow software developer. Went back (about three years) and located the code for this post in one of my older work-spaces. I updated the format of the post so it is easier to follow. I also added the code to my GitHub repository (see below).
:::: :::: :::: :::: ::::
After the post on unit testing I received a request to produce and explain sample code using JUnit. This is what I came up after searching the web using Google. I decided to use Eclipse for this example. Continue reading “JUnit Example”
I have dedicated my professional career to different disciplines (i.e., graphics, software engineering) within Computer Science. In this blog entry I would like to summarize some observations regarding computer languages. At different stages in life (e.g., college, work, self study, and business owner) most developers are required or just decide to learn different programming languages. An issue that frequently comes up with project managers is: “Knowing and using multiple programming languages is better or worse for a software developer?” In this blog entry I would like to provide some insights on how to respond to this question. Continue reading “Multiple Programming Languages”
Earlier this week I was talking with a colleague about sites that are becoming quite popular with software developers (e.g., HackerRank https://www.hackerrank.com). The format is quite similar between sites. A problem is described. You need to write correct code to solve it.
All have a window in which you can write the necessary code. Most of the constraints for the problem are described. The better sites provide some sample data sets to test your solution. Continue reading “Coding Exercise”