public void LongestPalindrome_Test() { var solution = new Solution5(); var res = solution.LongestPalindrome("cbbd"); Assert.Equal("bb", res); }
static void BracketsRotation(string S, int k, int res) { var s = new Solution5(); int t = s.solution(S, k); //s.Dispose(); if (t != res) { throw new Exception($"For: {S} input wrong result. {t}(wrong) != {res}(good)"); } }
static void Main(string[] args) { #region Q5 string q51 = new Solution5().LongestPalindrome("babad"); Console.WriteLine(q51); string q52 = new Solution5().LongestPalindrome("cbbd"); Console.WriteLine(q52); string q53 = new Solution5().LongestPalindrome("ccd"); Console.WriteLine(q53); string q54 = new Solution5().LongestPalindrome("aacdefcaa"); Console.WriteLine(q54); string q55 = new Solution5().LongestPalindrome("a"); Console.WriteLine(q55); string q56 = new Solution5().LongestPalindrome("aa"); Console.WriteLine(q56); string q57 = new Solution5().LongestPalindrome("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); Console.WriteLine(q57); #endregion #region Q4 var q41 = new Solution4().FindMedianSortedArrays(new[] { 1, 3 }, new[] { 2 }); Console.WriteLine("OK"); var q42 = new Solution4().FindMedianSortedArrays(new[] { 1, 3 }, new[] { 2, 4 }); Console.WriteLine("OK"); #endregion #region Q3 var q30 = new Solution3().LengthOfLongestSubstring("abcabcbb"); Console.WriteLine(q30); var q31 = new Solution3().LengthOfLongestSubstring("bbbbb"); Console.WriteLine(q31); var q32 = new Solution3().LengthOfLongestSubstring("pwwkew"); Console.WriteLine(q32); var q33 = new Solution3().LengthOfLongestSubstring("jlygy"); Console.WriteLine(q33); #endregion #region Q2 var x = new Solution2.ListNode(2) { next = new Solution2.ListNode(4) { next = new Solution2.ListNode(3) } }; var y = new Solution2.ListNode(5) { next = new Solution2.ListNode(6) { next = new Solution2.ListNode(4) } }; var x1 = new Solution2.ListNode(9); var y1 = new Solution2.ListNode(1) { next = new Solution2.ListNode(9) { next = new Solution2.ListNode(9) } }; var q2 = new Solution2().AddTwoNumbers(x1, y1); Console.Write("ok"); #endregion #region Q1 var q1 = new Solution1().TwoSum(new[] { 5, 75, 25 }, 100); Console.WriteLine(q1); #endregion }