src/anagramsolver/services/LoopSetsHelper.cs
/// <summary>
/// Add number of each letter of three words, 
/// so the sum can be compared with the sum in the anagram
/// Rows contains no-of-chars in each word.
/// CombineRows() sums up no-of-chars for all words in a sentence
/// </summary>
/// <param name="rows">No-of-chars in each word</param>
/// <returns>Summed up no-of-chars for all words in a sentence</returns>
Add number of each letter of three words,
so the sum can be compared with the sum in the anagram
Rows contains no-of-chars in each word.
CombineRows() sums up no-of-chars for all words in a sentence
Add number of each letter of three words so the sum can be compared with the sum in the anagram Rows contains no - of - chars in each word . CombineRows () sums up no - of - chars for all words in a sentence
protected int[] CombineRows(int[][] rows)
        {
            int[] combinedRow;
            var noOfRows = rows.Length;
            if (noOfRows > 0)
            {
                var lenOfaRow = rows[0].Length;
                combinedRow = new int[lenOfaRow];
                for (int col = 1; col < lenOfaRow; col++)
                {
                    for (int row = 0; row < noOfRows; row++)
                    {
                        combinedRow[col] += rows[row][col];
                    }
                }
            }
            else
            {
                throw new ApplicationException("CombineRows() needs two or more rows");
            }
            return combinedRow;
        }
protected int [ ] CombineRows ( int [ ] [ ] rows ) { int [ ] combinedRow ; var noOfRows = rows . Length ; if ( noOfRows > 0 ) { var lenOfaRow = rows [ 0 ] . Length ; combinedRow = new int [ lenOfaRow ] ; for ( int col = 1 ; col < lenOfaRow ; col ++ ) { for ( int row = 0 ; row < noOfRows ; row ++ ) { combinedRow [ col ] += rows [ row ] [ col ] ; } } } else { throw new ApplicationException ( " " ) ; } return combinedRow ; }
Add number of each letter of three words,
so the sum can be compared with the sum in the anagram
Rows contains no-of-chars in each word.
Add number of each letter of three words so the sum can be compared with the sum in the anagram Rows contains no - of - chars in each word .
// Assign space for result // Word is stored from col3 onwards - loop it. // Col1 is number of chars // Combine a column
Summed up no-of-chars for all words in a sentence
Summed up no - of - chars for all words in a sentence
rows
int[][]
No-of-chars in each word
No - of - chars in each word