Skip to main content

Posts

Showing posts with the label reverse

Java 8 Coding challenge: Swapping Characters

Your are given a string of length  N . You have to follow some rounds of swapping in the string until the below explained condition is reached. In each round the, you have to swap the  ith and (i+1)th character  , then  (i+2)th and (i+3)th  character and continue till the end of string. In each round , a character from the left will be locked i.e not available for swapping after this round , thus after some rounds of swapping , all the characters will be locked at their final position to stop any more rounds of swapping . See the sample explanation for more clarity. Input The first line of input contains a  T , the number of test case. The first line of each Test case will contain an Integer  N  , denoting the length of the string. The second line of each Test case will contain a string of length  N . Output For each and every test case, output the string after all positions are locked. Constraints 0< T <100 0< N ...

Java 8 Coding challenge: Swapping Characters

Your are given a string of length N . You have to follow some rounds of swapping in the string until the below explained condition is reached. In each round the, you have to swap the ith and (i+1)th character , then (i+2)th and (i+3)th character and continue till the end of string. In each round , a character from the left will be locked i.e not available for swapping after this round , thus after some rounds of swapping , all the characters will be locked at their final position to stop any more rounds of swapping . See the sample explanation for more clarity. Input The first line of input contains a T , the number of test case. The first line of each Test case will contain an Integer N , denoting the length of the string. The second line of each Test case will contain a string of length N . Output For each and every test case, output the string after all positions are locked. Constraints 0< T <100 0< N <10000 SAMPLE INPUT 2 6 abcdef 3 abc SAMPLE OUTPUT bdfeca bca E...

Java 8 coding challenge: Addition ain't simple

Jack is awesome. His friends call him little Einstein. To test him, his friends gave him a string. They told him to add the string with its reverse string and follow these rules: Every  i th  character of string will be added to every  i th  character of reverse string. Both string will contain only lower case alphabets(a-z). Eg:- a+a=b,a+c=d,z+a=a (Refer to sample test cases for more details) Input: First line contains a value  N  denoting number of test cases. Next  N  lines contains string  str . Output: For every string  str  output the string that Jack's friends wants from him. Constraints 1 <= N <= 10 1 <= str <= 10^5 SAMPLE INPUT     4 hello codeapocalypse programming world SAMPLE OUTPUT     wqxqw hhtdmqrrqmdthh wfxtebetxfw aajaa Code: import java.io.*; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Map; p...

Java 8 coding challenge: Addition ain't simple

Jack is awesome. His friends call him little Einstein. To test him, his friends gave him a string. They told him to add the string with its reverse string and follow these rules: Every i th character of string will be added to every i th character of reverse string. Both string will contain only lower case alphabets(a-z). Eg:- a+a=b,a+c=d,z+a=a (Refer to sample test cases for more details) Input: First line contains a value N denoting number of test cases. Next N lines contains string str . Output: For every string str output the string that Jack's friends wants from him. Constraints 1 <= N <= 10 1 <= str <= 10^5 SAMPLE INPUT 4 hello codeapocalypse programming world SAMPLE OUTPUT wqxqw hhtdmqrrqmdthh wfxtebetxfw aajaa Code: import java.io.*; import java.util.HashMap; import java.util.InputMismatchException; import java.util.Map; public class AdditionAintSimple { static class Print { private final BufferedWriter bw; public Print() { this.bw = new Buffere...

Security hardening for nginx (reverse proxy)

This document can be used when enhancing the security of your nginx server. Features provided in Security Hardening for nginx server In this security hardening we first update the nginx server. Its advantages are  that it has  SPDY 3.1  support, authentication via subrequests,  SSL session ticket  support, IPv6 support for DNS, PROXY protocol support. It also includes following features error logging,  cache revalidation directives , SMTP pipelining, buffering options for FastCGI, improved support for MP4 streaming, and extended handling of byte-range requests for streaming and caching. We also remove the SSL support and add  TLS  support.  It used to be believed that TLS v1.0 was marginally more secure than SSL v3.0, its predecessor.  However, SSL v3.0 is getting very old and recent developments, such as the   POODLE  vulnerability  have shown that SSL v3.0 is now completely insecure.  Subsequen...

Security hardening for nginx (reverse proxy)

This document can be used when enhancing the security of your nginx server. Features provided in Security Hardening for nginx server In this security hardening we first update the nginx server. Its advantages are  that it has SPDY 3.1 support, authentication via subrequests, SSL session ticket support, IPv6 support for DNS, PROXY protocol support. It also includes following features error logging, cache revalidation directives , SMTP pipelining, buffering options for FastCGI, improved support for MP4 streaming, and extended handling of byte-range requests for streaming and caching. We also remove the SSL support and add TLS support.  It used to be believed that TLS v1.0 was marginally more secure than SSL v3.0, its predecessor.  However, SSL v3.0 is getting very old and recent developments, such as the   POODLE  vulnerability have shown that SSL v3.0 is now completely insecure.  Subsequent versions of TLS — v1.1 and v1.2 are  significantly more secure   and fix many vulnerab...