Posts

Showing posts from September, 2017

Subsequence Equality

Image
Hey guys, This problem I have taken from www.codechef.com to speed up our coding practice skills and now regularly add a new problem with its solution to clear our Java concept and sharp our logical skills. Problem :  Chef Tobby is playing a rapid fire with Bhuvan. He gives Bhuvan a string  S  and each time, Bhuvan has to guess whether there exists  2  equal  subsequences  in the string or not. Bhuvan got a perfect score in the game with Chef Tobby. However, Chef Tobby has now asked Bhuvan to write a program that will do this automatically given a string  S . Bhuvan is an intelligent man but he does not know how to write a code. Can you help him? Find two different subsequences such that they are equal in their value, more formally, find two sequences of indices (a 1 , a 2 , ..., a k-1 , a k ) and (b 1 , b 2 , ..., b k-1 , b k ) such that: 1≤ a i , b i  ≤ |S| a i  < a i+1  for all valid i b i  < b i+1  for all valid i S a i  = S b i  for all valid i there exist

Secure Database Connectivity in node.js with mysql

Image
Hi Everyone! Yesterday my friend Andrea from Italy asked me a question about secure Database connectivity in node.js with mysql i.e. he wants to a secure database connection in node.js for some secure keys like username,password,database name that we use during database connectivity.His problem is obviously right from security point of view as we know that JavaScript is client side scripting knowledge so it is compiled on client side so after inspecting page some one can be able to view these secure keys which I discussed previously. I surf internet and found there are various ways to solve this problem I am not discussing all of them here but also I discussing here two of them and after this discussion I think Andrea and other reader who are facing with same problem can be able to resolve their problem. I choose two ways to solve this problem. Connection code in app.js file Create a Json file Connection code in app.js file : Javascript is client side language and code i