Runtime error - constructor not being called.


  • 1
    P

    This is the C# version. Not sure what is wrong. Have an stdout as the first line in the constructor, it is not executed since there is no stdout output on running with the following input (this is the default input)

    ["Excel","get","set","get"]
    [[3,"C"],[1,"A"],[1,"A",1],[1,"A"]]

    public Excel(int H, char W) {
            Console.WriteLine("Constructor");
    

    Does anyone have any idea what the runtime error here might be?


  • 0
    P

    Even the following code gives a runtime error (Same input as in OP). Something definitely isn't right with the C# version.

    How can I get this to the attention of the right people so that it is fixed?

    public class Excel {
        
        public Excel(int H, char W) {
            Console.WriteLine("Constructor");
        }
        
        public void Set(int r, char c, int v) {
            
        }
        
        public int Get(int r, char c) {
            return 0;
        }
        
        public int Sum(int r, char c, string[] strs) {
            return 0;
        }
    }
    
    /**
     * Your Excel object will be instantiated and called as such:
     * Excel obj = new Excel(H, W);
     * obj.Set(r,c,v);
     * int param_2 = obj.Get(r,c);
     * int param_3 = obj.Sum(r,c,strs);
     */
    
    

  • 0
    N

    same error here.
    There kind of runtime error occurred in last week's MaximumDistanceinArrays problem.


  • 0
    P

    Even this is throwing runtime error. I think the issue is with OJ, I have been getting internal errors from yesterday

    public class Excel {
    
        public Excel(int H, char W) {
            
        }
        
        public void Set(int r, char c, int v) {
            
        }
        
        public int Get(int r, char c) {
            return 0;
        }
        
        public int Sum(int r, char c, string[] strs) {
            return 0;
        }
    }
    

  • 0
    M

    Oh good. So it wasn't just me. :)

    I've written to the team and, hopefully, they will respond to us soon.

    In the meantime, there are other problems to solve. ;)


  • 0
    M

    Good news!

    I got a reply saying that the issue has been fixed. I haven't yet tested it myself, but I'm confident they sorted it out.


  • 0
    C

    It seems that I met the same problem with you. I am feeling confused now...


  • 1
    N

    @cheermc
    The issue has been fixed, i'm able to submit my AC solution
    https://discuss.leetcode.com/topic/93912/c-ac-solution


  • 0
    A

    Right now I can't run the code through c++ version, it says
    Line 64: no matching function for call to 'Excel::sum(int, char, std::vector<std::__cxx11::basic_string<char> >, int)' under the following code:

    class Excel {
    public:
        Excel(int H, char W) {
            
        }
        
        void set(int r, char c, int v) {
            
        }
        
        int get(int r, char c) {
            return 0;
        }
        
        int sum(int r, char c, vector<string> strs) {
            return 0;
        }
    };
    

    And also, the expected answer pop out such message (after hitting run code button):
    Line 23: error: method sum in class Excel cannot be applied to given types;

    The test input is :
    ["Excel","get","set","get"]
    [[3,"C"],[1,"A"],[1,"A",1],[1,"A"]].

    Any one has this issue the same as me?


  • 0
    C

    @newdev Mine here is still not working...


  • 0
    N

    @actionlee0405
    i guess they are change method interface to something like below.
    just feel weird.
    int sum(int r, char c, vector<string> strs, int x) {
    return 0;
    }


  • 0
    N

    @cheermc
    just check, my solution is ok.
    what error did you get, could you add your code if possible


  • 0
    C

    @newdev

    I just use the simple one and it fails as below:

    public class Excel {
    public Excel(int H, char W) {
     
    }
    
    public void set(int r, char c, int v) {
        
    }
    
    public int get(int r, char c) {
        return 0;
    }
    
    public int sum(int r, char c, String[] strs) {
        return 0;
    }
    

    }

    The expected answer is:
    Line 23: error: method sum in class Excel cannot be applied to given types;
    Show Diff

    even if there is no 'Line 23' in the code.


  • 0
    N
    This post is deleted!

  • 1
    N

    @cheermc

    i think it looks like similar problem as c++ user
    once you change method interface to below , it will pass compile, but i'm not sure if you could submit AC solution yet.
    still need admin to fix the issue.

    public class Excel {
    
        public Excel(int H, char W) {
            
        }
        
        public void set(int r, char c, int v) {
            
        }
        
        public int get(int r, char c) {
            return 0;
        }
        
        public int sum(int r, char c, String[] strs, int x) {
            return 0;
        }
    }
    

  • 0
    M

    Yip. It's still broken. Yesterday, it compiled this empty solution, but it has gone back to it's broken state. :(


  • 0
    A

    @newdev So I think there is some bug in the OJ. I passed the test with the provided interface without adding any int in the sum function. But the Run Code function seems to have another interface, so I have to change the interface of the sum function to run the program.


  • 0
    A

    Encountered the same error with my Java code:
    Line 23: error: method sum in class Excel cannot be applied to given types;

    My line 23 doesn't use the Excel's class sum method.


  • 0

    This was just fixed.


  • 0
    C

    @1337c0d3r you're right.


Log in to reply
 

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