Ad
  • Custom User Avatar

    You're right. Thank you for help

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Okay, I think I see now. So I guess since it's a string, it doesn't recognize if the number is positive or negative - every position in this string is a char, so 42 is actually 4 and 2, and actually(since it doesn't recognize negative numbers) that's why this returns 9 as max. Okay, now it cleared up to me. Should have thought of this earlier. Okay, thanks.

  • Custom User Avatar

    Not exactly the same as the others, as far as I see, since I am not sorting anything, unless those two methods are considered sorting. I also read your comment from bellow, and according to this, if the first element in a string is considered maximal, then Max() method should return "8", not 9(apart of the fact that there is -9, not 9) and Min() should return -4(but it returns blank space). So in order to check what you are saying, i deleted -9 from test case, and what is strange to me, it returned the first value, as you stated in the comments below. The thing which is even more odd, is the fact that I also deleted number 8, Max() returned 7(which is clearly not first on the list, as 3 is).

    EDIT:
    Well, I don't exactly understand why it is happening, though I see that indeed I should convert it to a list of numbers first. However, to be honest, it is quite senseless. Converting it to a list of numbers only to use sorting method? Why do it if you have, as i mentioned them, Linq methods for returning max and min number, which according to you should return MAX as the first item on the list and MIN as the last item on the list. And for some reason, sometimes it does and sometimes it doesn't, which I don't understand.

  • Custom User Avatar

    You mean this thing containing numbers? It's a string.

  • Custom User Avatar

    I am little bit confused, because I used Min() and Max() methods, from Linq, and the result is quite odd. Min() returned nothing and Max() returned the lowest value but unsigned. What is the reason? Am I missing something?

  • Custom User Avatar

    Nevermind, I solved it.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Okay, so... I am a little bit stuck. In this task, currently I am at the point where i have all the letters converted to uppercase and i wanted to... Now that I write about it, i think it could be easier for me to - firstly multiply the number of each letter and then add a dash there... Okay, well let's say i already multiplied the number of them(i will deal with it later) and now i need to add a dash. I tried several manners to solve this, including: for and foreach(and now that i think of it, i can't use foreach if i want to add a dash after multiplying the letters) with String.Join, String.Insert or something called StringBuilder with Append(which I don't exactly understand) and it does nothing to the string.

    Can any of you please give me any advice or hint how to deal with inserting this dash or in what order should i proceed(add dash first or multiply the number of letters and then add the dash) and how exactly to do this(any hint for some method).
    Thank you.

  • Default User Avatar

    Thank you guys, I considered what you said and also just had a lecture where i got to know some things, so case is solved.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution