示例#1
0
文件: 6.cs 项目: qifanyyy/CLCDSA
            public int MovesToMatch(StringReduced other)
            {
                int moves = 0;

                for (int i = 0; i < this.substrings.Count; i++)
                {
                    moves += Math.Abs(this.substrings[i].Item2 - other.substrings[i].Item2);
                }
                return(moves);
            }
示例#2
0
文件: 6.cs 项目: qifanyyy/CLCDSA
            public bool CanMatch(StringReduced other)
            {
                // if number of substrings is different, they can't match
                if (this.substrings.Count != other.substrings.Count)
                {
                    return(false);
                }

                // if order is different, they can't match
                for (int i = 0; i < this.substrings.Count; i++)
                {
                    if (this.substrings[i].Item1 != other.substrings[i].Item1)
                    {
                        return(false);
                    }
                }

                return(true);
            }