How to Enable/Install apache mod_rewrite and mod_headers in ubuntu

Last week while i was working on url rewriting i face the problem. I had written the rule in .htaccess but forget to enable the mod_rewrite. Remember your .htaccess rule will not work until you enable the mod_rewrite.

How to install apache2 on ubuntu

Go to terminal (ctrl+Alt+T) and write the following command

Once apache2 installation is complete. Write the command mentioned below to enable mod_rewrite

After enable the mod_rewrite do the changes on following file

After done the changes restart the apache.

To restart apache2

Enable mod_headers in apache

Remember to restart apache 

So to restart apache2 write through terminal

Find Duplicate Elements in an Array – Java Program

Write a java program to find duplicate elements in an array. Given an array of integers, We have to write a code to find all duplicate elements in an array.

For example :

Input : arr = { 2, 5, 3, 1, 8, 7, 5, 3, 2 }

Output: {5, 3, 2}

In this tutorial, I am going to explain three approaches to find duplicate elements in an array. This question is also very important for technical interviews.