It February, the month of Love.
For those with partners, remember it Valentines Day on the 14th
(WTF, A coder with a partner?)
Challenge
Fill in the code to calculate what percentage one member loves another.
Example
Locke loves supersloth how much?
LOVES 22022 <-- Count of each letter. 4224 <-- (2+2), (2+0), (0+2), (2+2) 646 <-- (4+2), (2+2), (2+4) 00 <-- (5+4), (4+6) ' Last one
Note how the 4+6 is 0 and not 10, this so the calculation converges.
Extra Clarification The values in each must be 0<= x < 10 at all stages, this includes the count of each letter.
So Locke loves supersloth 00% of the time.
Letter casing is iqnored so Aa are the same.
Function Loves(ByVal PersonA As String, ByVal PersonB As String) As Integer) ' Your code goes here ' End Function
Scoring Rules
You can assume the inputs will be non null or nothing.
Must compile with
Option Strict On Option Infer On
Is the same code golf standard, the count of non-whitespace character inside the function method.
For this hole an allowance of -6 (to account for the required keyword Return.
Edit: Update and corrected calculation
Example Submission
This post has been edited by AdamSpeight2008: 03 February 2011 - 07:02 PM

New Topic/Question
Reply



MultiQuote







|