Puzzle No: 255 July-21-2008(4) @ Novell
Yes, i know that, title looks weired and confusing. But while managing my backup i found this old puzzle with solution. Let me explain in detail. When i was in Novell, i used to wrote articles on SLES / SLED. Due to that interest, one day my friend redirected me to puzzle section of company wide circular, it was mostly for social activities. First top five, who solved that puzzle got their name in next circular. Imagine your name around 500+ people. So i thought let’s jump in this fame game
So, title contains Puzzle Number of that puzzle which i attended very first time.
Puzzle No: 255 July-21-2008(4)
What would be the value of X and Y to correct X * Y * XY = YYY equation?
I was BASH freak, due to my Q/A Automation work @ Novell. So i thought, let’s not find one result, make it automated to find different possibilities of X and Y. I decided to wrote BASH script with TRY / ERROR methodology. Which took my 30 Minutes due to cosmetic changes. I was feeling top of the world because of my Hard Work + Smart Work deadly combo
. I submitted my solution (Answer + Script). But, in next circular i was not in top five
.
Then i did retrospective analysis of my failure, which helped me to manage my name in top five for next few month. I also took part in Novell Test Fest 2008 by winning series of on-line quizzes. My team was First Prize Winner in Novell Test Fest 2008. Then my friend, who had redirected me to that Puzzle Fame Game (For me at-least) came and told me that you are true winner, you have not used Google. I didn’t say anything, i just smiled
Download script to solve Puzzle No: 255 July-21-2008(4) @ Novell: What would be the value of X and Y to correct X * Y * XY = YYY equation? (Please don’t file any Bug
):
person@CANONICAL-DESK:~/DATA/PUZZULES$ cat 255
#!/bin/bash
###############################################
# Puzzle No: 255 July-21-2008(4) #
# Author: “Hardik Dalwadi” <dhardik@novell.com> #
# Version: 1.0 #
# ChangeLOG: 1. Not considering posibiity of X=0 and Y=0 #
# 2. Support for Try & Error Count if we satrt from #
# X=1 and y=1 #
###############################################
### Sucess Codes ###
E_SUCCESS=0
E_ERROR=1
### Initializing X and Y ###
X=0
Y=0
### Initializing Try & Error Count ###
Z=0
### Clearing Screen ###
clear
### Here we GO ###
### Starting from Y=1 ###
for Y in `seq 1 9`
do
### Starting from X=1 ###
for X in `seq 1 9`
do
YYY=”$Y$Y$Y”
XY=”$X$Y”
let ‘RESULT=X * Y * XY’
let Z++
echo “Try & Error Count : $Z”
echo “Possibility of X : $X”
echo “Possibiligy of Y : $Y”
echo “So, YYY Would be : $YYY”
echo “So, XY Would be : $XY”
echo “So, X * Y * XY : $RESULT”
echo “Comparing Eqation X * Y * XY = YYY”
### Comparing Equation ###
if [ $YYY -eq $RESULT ]
then
echo -en ‘\E[47;34m’”\033[1mRESULT = POSITIVE”
echo
echo -en ‘\E[47;34m’”\033[1mSo, Possibility of X = $X and Y = $Y to make the equation X * Y * XY = YYY Possible!”
echo
exit $E_SUCCESS
else
echo
echo -en ‘\E[47;31m’”\033[1mRESULT = NEGTIVE”
echo
fi
sleep 1
clear
done
done
### Here we STOP ###
person@CANONICAL-DESK:~/DATA/PUZZULES$
Answer of the puzzle and positive output from script with statistics:
Try & Error Count : 57
Possibility of X : 3
Possibiligy of Y : 7
So, YYY Would be : 777
So, XY Would be : 37
So, X * Y * XY : 777
Comparing Eqation X * Y * XY = YYY
RESULT = POSITIVE
So, Possibility of X = 3 and Y = 7 to make the equation X * Y * XY = YYY Possible!
person@CANONICAL-DESK:~/DATA/PUZZULES$


