Evening Reading
by Xav de Matos, Jan 18, 2011 5:00pm PSTAs I sit here and type this the only thing I can think about are the piles of previews and interviews I have to write out for the rest of this week. When I say "rest of this week," what I really mean is tonight because I don't have any other time to do it. Thankfully, I'm taking a breather beginning Friday and returning on Monday night.
I haven't traveled for non-work related reasons in a while, so it will be nice to not have to worry about my schedule, or laptop, or voice recorder. Or taking piles of notes.
Speaking of notes, remember to jot down this note for yourself: "Keep refreshing Shacknews tomorrow morning because Nintendo is set to reveal its launch details for the 3DS in North America tomorrow."
Here's the video game news of the day from the Shack to tide you over while you wait until the morning:
- Portal 2 Packs PC-PS3 Cross-platform Play & Chat
- Square Announces Final Fantasy XIII-2 for PS3 and Xbox 360
- Bethesda Details 'Creation Engine' for Elder Scrolls V
- Report: Nintendo 3DS Will Have a Form of Region Protection
Here are some random musings from around the web:
Dragon's Prophet preview: how to catch your dragon
Report: Respawn Entertainment co-founder left due to personal conflict
Oculus Rift secures $16 million in venture capital
Max Payne 3 slowly dives onto Mac this week
Report: Frostbite 3 games to be 'optimized exclusively' for AMD cards
Given an array of numbers
[4, 6, 8, 3]
Work out how many steps it takes to make them all the same number if you can only increment them by +1/-1 per step.
I worked out the average of the array then took the difference between the average and the number furtherest away from it. Was this correct?
Thread Truncated. Click to see all 31 replies.
Write a function
def triangle(arr)
which given a zero-indexed array A of n integers returns 1 if there exists triple i,j,k (, ) such that:
A[i] + A[j] > A[k]
A[i] + A[k] > A[j]
A[j] + A[k] > A[i]
or returns 0 otherwise.
Examples:
For:
A[0]=10, A[1]=2, A[2]=5, A[3]=1, A[4]=8, A[5]=20
your function should return 1, since for i=0,j=2,k=4 all conditions are fullfiled (i.e. A[2]+A[4]>A[0]).
For:
A[0]=10, A[1]=50, A[2]=5, A[3]=1
your function should return 0.
You must be logged in to post.