Exemplo n.º 1
0
bool containsNearbyDuplicate(int* nums, int numsSize, int k) {

if(numsSize < 2)
{
    return false;
}
struct Set set;

initSet(&set, numsSize);
for(int i = 0; i < numsSize; ++i)
{

    if(i>k)
    {
        removeVal(&set,nums[i-k-1]);
    }
    if(!addValue(&set, nums[i]))
    {
        releaseSet(&set);
        return true;
    }

}
releaseSet(&set);

return false;
}
Exemplo n.º 2
0
void FunctionParam::reset( const FunctionParam& a )
{
    m_type   = a.m_type;
    m_long   = a.m_long;
    m_double = a.m_double;
    m_str    = a.m_str;

    releaseSet();
    if (a.m_set != 0) {
        FunctionParams* afps = (FunctionParams*) a.m_set;
        FunctionParams* thisfps = new FunctionParams;
        *thisfps = *afps;
        m_set = thisfps;
    }
}
Exemplo n.º 3
0
FunctionParam::~FunctionParam()
{
    releaseSet();
}