We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Sequence Equation
Sequence Equation
Sort by
recency
|
1532 Discussions
|
Please Login in order to post a comment
Java
Here is my O(N) c++ solution, you can watch the explanation here : https://youtu.be/D9nfVOmmv7Q
Here is my one line Python solution!
The Sequence Equation can be tricky, but once you break it down step by step, it starts making sense! It's kind of like how Concrete Estimating Services work — you need accuracy and attention to detail. If you're looking for an easier way, using capcut for pc tools can really simplify the process and save time.
Python Method : Create dict to store the element as key and the index+1 of
p
as value. For example, [5,2,1,3,4] we can get {5:1, 2:2, 1:3, 3:4, 4:5} and usep_dict[p_dict[1]]
to get the answer4
. It can reduce the computing oflist.index()
.