I have always been partial to SQLRPGLE rather than writing around those chain statements in the RPGLE. More often than not, we are worried about the correctness and not about the efficiency of the program. Even I was not be excused on this accusation, well we can argue how can you increase the performance if we don’t know how it works right? So,…

So, normally I would go for SQLRPGLE for simple fetch operations but if I have to update the data in the file itself, I would normally rely on the trusty RPGLE command READ/READE/CHAIN and UPDATE/DELETE. Consider the following code. Now earlier when I had do this using SQLRPGLE, I used to store the keys from the fetch into variables, do…

A Discrete Mathematics professor has a class of N students. Frustrated with their lack of discipline, he decides to cancel class if fewer than K students are present when class starts. Given the arrival time of each student, determine if the class is canceled. Input Format The first line of input contains T, the number of test cases. Each test…

Here is one more coding challenge that I have solved in HackerEarth. Problem Statement You are given an array of N integers which is a permutation of the first N natural numbers. You can swap any two elements of the array. You can make at most K swaps. What is the largest permutation, in numerical order, you can make? Input…

So Here is another challenge from the Code Fights, that I solved today. The problem is as following:

## Recent Comments