|
No footprints. Nothing modified from the previous post, just removed the optional extra solutions.
typedef std::map<int*, int>::iterator it_type;
int arrNum[] = { 1, 2, 6, 4, 5, 7, 8, 9, 2, 2, NULL };
int* pBegin = (int*)&arrNum[0];
int* pStart = pBegin; int* pNext = pBegin +1;
std::map<int*, int> _mapSeg;int nCounter = 0;
_mapSeg[pBegin] = nCounter;
while (NULL != *pBegin)
{ _mapSeg[pStart] = nCounter++;
if (*pBegin + 1 != *pNext && (*pBegin != *pNext))
{ nCounter = 0;pStart = pNext;}
++pBegin;++pNext;
}
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
modified 27-May-16 2:53am.
|
|
|
|
|
Then there is the Manager solution:
Ted,
I need a function that splits a list of integers into sublists, so that each sublist only contains runs of consecutive digits.
I know you're busy with all the extra items this week, but if you could get that for me today, that would be great.
TIA,
Mike
|
|
|
|
|
The "lean and green" solution asks "Why perform all those allocations, copies, and inserts? Just return an array of the substrings' lengths":
int
MapSubarrays
(
int Len
,
int* Arr
,
int* Map
)
{
int result = 0 ;
int i ;
Map [ 0 ] = 1 ;
for ( i = 1 ; i < Len ; i++ )
{
Map [ i ] = 0 ;
if ( Arr [ i ] - Arr [ i - 1 ] != 1 )
{
result++ ;
}
Map [ result ]++ ;
}
return ( result ) ;
}
Then let the caller do what it wants with the result.
3 : { 1 , 2 , 3 }
3 : { 5 , 6 , 7 }
1 : { 22 }
modified 26-May-16 23:37pm.
|
|
|
|
|
Incredibly powerful CRM. It's amazing how you can create complex objects with table joins, lookups, etc., play around with the UI, etc., and their servers are FAST.
That said, it took me six hours to figure out how to import a CSV, figure out that if you mark a field as currency, it still won't parse $ and , and that you want to map your CSV header columns exactly to object fields because otherwise you have to manually map them, and because you'll be trying the import, like 50 times before you get it right, it's a big time saver not to have to manually map them every time!
Whew. And all this pro bono for a non-profit that asked me to help them out.
Marc
|
|
|
|
|
Sorry, but if a non-profit organisation can afford salesforce, then they can afford to pay you to fix it for them.
When a sweet smile means "I can pay the big guys, but you can go f*** yourself", modify it with a bunch of fives.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
They're using the free non-profit starter pack that SF offers.
Marc
|
|
|
|
|
The old adage applies, no good deed goes unpunished...
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Marc Clifton wrote: all this pro bono for a non-profit that asked me to help them out.
Ah, but think the of the warm fuzzy feelings you will have from helping out. Seriously though, it shows good form IMHO, helping others out, when needed.
|
|
|
|
|
Hi All,
I am trying to run YouTube on my Android phone once I minimize, then it stops running, what I did was couple of apps I downloaded to run them in the background. But unfortunately they are all running but not picking up the next video how youtuble on IE or Chrome picks it.
I want both the next video should be picked up and should be running in the background and for free. Is there any idea please?
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Bash.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Though not sure this is the right place to ask such Qn, You can use YouTube Red by Google inc.
|
|
|
|
|
Sumuj John wrote: Though not sure this is the right place to ask such I don't see why. I thought it was a very appropriate question.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hey,
I am here at Edison New jersey for next couple of weeks any codeproject guy is there so we can catch up and have some fun.
Thanks
Suvabrata
Life is all about share and care...
public class Life : ICareable,IShareable
{
// implements yours...
}
|
|
|
|
|
Suvabrata Roy wrote: we can catch up and have some fun.
Everything about this, is just wrong...on so many levels.
|
|
|
|
|
This is Wong on so many levels.[^]
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
|
In exiting VS, it asked me if I wanted to save my changes I agreed by clicking the red X at the top right of the dialog.
I was led to believe that the red X at top right of a window or dialog box is now the OK button.
|
|
|
|
|
You did not save your work for 6 hours? Wow!
Get me coffee and no one gets hurt!
|
|
|
|
|
|
My work's not worth saving for years on end, so he must be really good if it's only hours.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
23741 wrote: red X at top right of a window or dialog box is now the OK button. What led you believe that?
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
jeron1 wrote: What led you believe that? This[^].
/ravi
|
|
|
|
|
Oh does that suck!
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
"I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
|
|
|
|
|
Indeed. MS just lowered W10 from the PUP to the Malware level.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
Today's lesson is all about saving frequently as you go.
Tough lesson if want to learn by practical demonstration rather than theory
|
|
|
|