Why can't i use the "uthash.h" in this platform, please help solve the problem?thank you,complie error


  • 0
    M

    #include "uthash.h"
    #include <stdio.h>
    #include <stdlib.h>

    struct my_struct{
    int key;
    int value;
    UT_hash_handle hh;
    };

    int a[2] ={0};

    int *twoSum(int numbers[], int n, int target)
    {
    struct my_struct *st,*tmp;
    struct my_struct *users = NULL;
    st = (struct my_struct *)malloc(sizeof(struct my_struct));

    int i;
    for(i = 0; i < n; i++ ){
        HASH_FIND_INT(users,&numbers[i],tmp);
        if(tmp !=NULL){
            a[0] = st->value + 1;
        a[1] = i + 1;
        }
    
        st->key = target - numbers[i];
        st->value = i; 
    HASH_ADD_INT(users,key,st);
    }
    return a;
    

    }


  • -1
    J

    Are your using include "uthash.h" in your code?

    uthash is supported, and is included before... just don't use include in your code


  • 0
    M

    thank you very much! but it still occurs"Time Limit Exceeded" Error ? it said that hahstable in uthash have the same perfermence as well as in java or c++?


  • 0
    D
    This post is deleted!

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.