×
Home Discussions Write at Opengenus IQ
×
  • DSA Cheatsheet
  • HOME
  • Track your progress
  • Deep Learning (FREE)
  • Join our Internship 🎓
  • RANDOM
  • One Liner
Shujaa Ahmad

Shujaa Ahmad

Computer Science Student

Dehradun, Uttarakhand, India •
6 posts •
Software Engineering

Covariant Return Type in Java

Covariant return type in an Object oriented programming language means that the return type of any method can be replaced by a narrower type when it is overridden in the subclass or child class. We have explored it in Java in depth.

Shujaa Ahmad Shujaa Ahmad
Algorithms

Number of distinct elements in a given range

This is a problem in which we have an integer array which contains some elements and our job is to find out number of distinct elements in a given range. We have solved this using three methods with the most efficient approach being a hashing technique with linear time complexity O(N).

Shujaa Ahmad Shujaa Ahmad
Algorithms

Minimum number of characters to be deleted to make string a palindrome

In this problem, we have to formulate an algorithm to find the minimum number of characters to be deleted to make the string a palindrome. This can be solved using the Dynamic Programming approach for longest palindromic subsequence in O(N^2) time.

Shujaa Ahmad Shujaa Ahmad
Algorithms

Minimum characters added to the front of string to make it palindrome

In this problem, we have to formulate an algorithm to find the minimum number of characters to be added to the front of a string to make it a palindrome. To solve this efficiently in linear time O(N), we have to use longest prefix suffix of Knuth Morris Pratt pattern matching algorithm.

Shujaa Ahmad Shujaa Ahmad
Algorithms

Rearrange string such that no two adjacent characters are same

In this problem, we have to rearrange the characters of the string such that no two adjacent characters are same. To solve this efficiently in O(N log N) time, we will use priority queue data structure.

Shujaa Ahmad Shujaa Ahmad
Software Engineering

Inner Class in Java

In Java, inner class is a nested class which is defined within another class and it provides better encapsulation. There are several variants like anonymous inner class, method local inner class and much more.

Shujaa Ahmad Shujaa Ahmad
OpenGenus IQ © 2025 All rights reserved â„¢
Contact - Email: team@opengenus.org
Primary Address: JR Shinjuku Miraina Tower, Tokyo, Shinjuku 160-0022, JP
Office #2: Commercial Complex D4, Delhi, Delhi 110017, IN
Top Posts LinkedIn Twitter
Android App
Apply for Internship