Skip to main content
Code Review

Return to Question

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
  • Converted List<T> to array after reading this this
  • Changed foreach to a plain for loop that helped remove another index variable for iterating over string t
  • Converted List<T> to array after reading this
  • Changed foreach to a plain for loop that helped remove another index variable for iterating over string t
  • Converted List<T> to array after reading this
  • Changed foreach to a plain for loop that helped remove another index variable for iterating over string t
corrected spelling
Link
thebenman
  • 1.2k
  • 9
  • 27

Isomorphic stringstrings in LeetCode

deleted 30 characters in body
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

I solved this problem.:

For example,:

The code in C# on average took around 109ms to execute, which is a pretty slow as compared C++to the C++ version of the same algorithm than, which executes in under 6ms. Although, the fastest C#solutionC# solution for this problem is around 100ms.

Optimization?Optimizations I had done:

  • Converted List<T> to array after reading this
  • Changed foreach to a plain for loop loop that helped remove another index variable for iterating over string t

Can you suggest if there is any better way to squeeze some performance from the C#C# implementation.?

And from the FAQ section of LeetCode I could see that C#C# uses mono 4.2.1mono 4.2.1 and C++C++ uses g++ 5.4.0g++ 5.4.0.

I'm attaching the C++C++ solution as well just for reference:

I solved this problem.

For example,

The code in C# on average took around 109ms to execute which is a pretty slow as compared C++ version of the same algorithm than executes in under 6ms. Although the fastest C#solution for this problem is around 100ms

Optimization? I had done

  • Converted List<T> to array after reading this
  • Changed foreach to plain for loop that helped remove another index variable for iterating over string t

Can you suggest if there is any better way to squeeze some performance from the C# implementation.

And from the FAQ section of LeetCode I could see that C# uses mono 4.2.1 and C++ uses g++ 5.4.0

I'm attaching the C++ solution as well just for reference

I solved this problem:

For example:

The code in C# on average took around 109ms to execute, which is pretty slow compared to the C++ version of the same algorithm, which executes in under 6ms. Although, the fastest C# solution for this problem is around 100ms.

Optimizations I had done:

  • Converted List<T> to array after reading this
  • Changed foreach to a plain for loop that helped remove another index variable for iterating over string t

Can you suggest any better way to squeeze some performance from the C# implementation?

And from the FAQ section of LeetCode I could see that C# uses mono 4.2.1 and C++ uses g++ 5.4.0.

I'm attaching the C++ solution as well just for reference:

Source Link
thebenman
  • 1.2k
  • 9
  • 27
Loading
default

AltStyle によって変換されたページ (->オリジナル) /