Add Bold Tag in a String


  • 0

    Click here to see the full article post


  • 0
    C

    I have a question about the runtime of Approach#2: will the line of sorting "Collections.sort(list, (a, b) -> a[0] == b[0] ? a[1] - b[1] : a[0] - b[0]);" be the dominant part of run time?
    Since in the worst case the list size is O(s∗l), I guess sorting can take O(sllog(s*l)) ?


  • 0
    B

    The complexity analysis for method#2 is incorrect. We also need to factor in the runtime for sorting.


Log in to reply
 

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