October 29, 2009, 8:36 pm
You have a basket ball hoop and someone says that you can play 1 of 2 games. You get $1000 and one shot to get the hoop. Or, you get three shots and you have to make 2 of 3 shots. Which one do you choose? If p is the probability of making a particular shot, what value of p makes you switch games?
October 29, 2009, 11:50 am
searchJars.sh :
-----------------------------------------------------
#!/bin/bash
while getopts "n:il" optionName; do
case "$optionName" in
i) case_sensitive_op=-i;;
l) long_format=Y;;
n) search_expr="$OPTARG";;
[?]) echo "Usage: searchJars [-i] [-l] -n ";exit 1;;
esac
done
if [ -z $search_expr ]
then
echo "Usage: searchJars [-i] [-l] -n ";
exit 1;
fi
if [ $# -lt 1 ]
then
echo "Usage: searchJars [-i] [-l] -n ";
exit 1;
fi
REG_EXPR="$search_expr"
for i in `find . -name "*jar"`
do
jar tvf $i 2> /dev/null | grep $case_sensitive_op $REG_EXPR > /dev/null
if [ $? == 0 ]
then
echo $i
if [ "$long_format" = "Y" ]
then
jar tvf $i | grep $case_sensitive_op $REG_EXPR | awk '{ print " "$8}'
echo "-----------------------------------------------------"
fi
fi
done
-----------------------------------------------------
Usage:
Usage: searchJars [-i] [-l] -n CLASS_NAME_OR_EXPRESSION
October 28, 2009, 8:54 pm
You have an array of ints A[]. How would you find the two elements that sum to a particular value S?
Example:
let
A[] = {1,2,-40,4,20,53}
S=13.
Expected Answer:
53 and -40
October 28, 2009, 7:54 am
October 28, 2009, 7:50 am
October 28, 2009, 4:35 am
Here are some good perl links
Free Online Books
- Welcome to Perl 5 by Example
October 27, 2009, 8:34 pm
Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!