Why my output always 0.00000 although in my visual studio is 0 without coma..


  • 0
    J

    public class Solution {
    public long Reverse(long x) {
    string y = x.ToString();
    char[] z = y.ToCharArray();
    int lengths = z.Length - 1;
    if (z[0].Equals('-'))
    {
    Array.Reverse(z);
    y = new string(z);
    y = y.Trim('-');
    y = y.Insert(0, "-");
    long x2 = Convert.ToInt64(y);

                return x2 ;
            }
            else
            {
                Array.Reverse(z);
                y = new string(z);                
                long x2 = Convert.ToInt64(y);
                return x2;
            }
        }
    

    }


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.