Program : Remove duplicates from an array, keeping only the first occurrence of each element in C++. Solution : #include <iostream> using namespace std; void removeDuplicates(int array[], int& size) {…
Mahesh Verma
Mahesh Verma
I have been working for 10 years in software developing field. I have designed and developed applications using C#, SQL Server, Web API, AngularJS, Angular, React, Python etc. I love to do work with Python, Machine Learning and to learn all the new technologies also with the expertise to grasp new concepts quickly and utilize the same in a productive manner.
-
Array ProgramsC++ ProgramsPrograms
-
Array ProgramsC++ ProgramsPrograms
Find the second largest element in an array.
by Mahesh Vermaby Mahesh VermaProgram : Find the second largest element in an array in C++. Solution : #include <iostream> using namespace std; int findSecondLargest(const int array[], int size) { int largest = array[0];…
-
Program : Find the kth largest element in an array in C++. Solution: #include <iostream> using namespace std; int findKthLargest(int array[], int size, int k) { int maxIndex, i, j;…
-
Program : Find the median of an array. Explanation : The median of an array is the middle element when the array is sorted in ascending order. In other words,…
-
Array ProgramsC++ ProgramsPrograms
Find the frequency of each element in an array.
by Mahesh Vermaby Mahesh VermaProgram : Find the frequency of each element in an array. Solution : #include <iostream> using namespace std; void findFrequency(int array[], int size) { const int MAX_SIZE = 100; int…
-
Program : Check if an array is a palindrome in C++. Explanation: To check if an array is a palindrome or not, we need to understand what a palindrome is.…
-
C++ Coding ChallengesProgramming Challenges
Coding Challenge 2 : Count the trailing zeros
by Mahesh Vermaby Mahesh VermaCoding Challenge 2 : Count the Trailing Zeros in Factorial value Write a program in C++ that determines the number of trailing zeros at the end of N! (N Factorial),…
-
ArticleJAVA Programming
Packages in Java: Organizing and Enhancing Code Reusability
by Mahesh Vermaby Mahesh VermaIn the vast realm of Java programming, there exists a powerful mechanism called packages that brings order and structure to our code. Packages serve as containers that group related classes,…
-
Java ProgramsPrograms
PRACTICE QUESTIONS ON ABSTRACT CLASS – CLASS SHAPE
by Mahesh Vermaby Mahesh VermaCreate an abstract class “Shape” with abstract methods “getArea()” and “getPerimeter()”. Implement two subclasses “Rectangle” and “Circle” which extend “Shape” and implement the abstract methods. Create a “Square” class which…
-
Java ProgramsPrograms
PRACTICE QUESTIONS ON ABSTRACT CLASS – CLASS BANK
by Mahesh Vermaby Mahesh VermaCreate an abstract class “BankAccount” with abstract methods “deposit()” and “withdraw()”. Implement two subclasses “SavingsAccount” and “CheckingAccount” which extend “BankAccount” and implement the abstract methods. Create a “Customer” class which…