[Solved] write a function which takes a linked list as a parameter and returns nodes found in even positions in the original list

typedef struct node { int data; struct node* next; } node; node *copyEven(node *mylist){ node *newHead = NULL, *temptr = NULL; int count = 1; while(mylist){ if ( count % 2 == 0){ node* newNode = malloc(sizeof(node)); newNode->data = mylist->data; newNode->next = NULL; if(newHead == NULL){ temptr = newHead = newNode; } else { temptr … Read more

[Solved] Grouping js string array with counting

This a way to do this: var fruit = [‘apple’, ‘apple’, ‘orange’]; var occurences = {}; for (var index = 0; index < fruit.length; index++) { var value = fruit[index]; occurences[value] = occurences[value] ? occurences[value] + 1 : 1; } console.log(occurences); The logged output is an object containing apple: 2, orange: 1} as you can … Read more

[Solved] Write a function named containsLetter that identifies all of the strings in a list that contain a specified letter and returns a list of those strings [closed]

Is this ok ? >>> def containsLetter(searchLetter, hulkLine): … return [x for x in hulkLine if searchLetter in x] … >>> containsLetter(‘i’, hulkLine) [‘like’, “i’m”] >>> Or >>> filter(lambda x: searchLetter in x, hulkLine) [‘like’, “i’m”] >>> 4 solved Write a function named containsLetter that identifies all of the strings in a list that contain … Read more

[Solved] How to had try exception to log to logger using python

I have modified your script and it’s working import os import logging import sys logging.basicConfig(filename=”log.txt”,level=logging.INFO,format=”%(asctime)s- %(message)s”,filemode=”a”) def checkfileexist(Pth,Fle): var=Pth+”https://stackoverflow.com/”+Fle try : if (var is None): logging.error(‘Path is empty’) raise Exception(“empty path”) if os.path.exists(var): logging.error(‘File found’) return (var) else: raise Exception(“File Not found”) except Exception as e: logging.error(‘Not Found file’) sys.exit() def additionvalue(a,b): return (a+b) you … Read more

[Solved] javascript – Break search query string into object

You may want to take a look at this: addEventListener(‘load’, function(){ var wtf=”arg1:”2 words” business corporate arg2:val2 arg3:”fixedIt””; function customObj(string){ var a = string.split(/\s+(?!\w+”)/), x = [], o = {}; for(var i=0,s,k,l=a.length; i<l; i++){ s = a[i].split(/:/); k = s[0]; s[1] ? o[k] = s[1].replace(/”/g, ”) : x.push(k); } o[‘extra’] = x.join(‘ ‘); return o; … Read more

[Solved] HTML and Body is not 100% height [closed]

.container-main-fixedscroll needs to be height: calc(100% – 45px) because of the height of your header html, body { height: 100% } body { margin: 0px; font-family: repub; color: white; } .container-main-left { float: left; width: 15%; min-height: 100%; background-color: red; display: inline-block; line-height: 300%; } .container-main-right { float: right; width: 15%; min-height: 100%; background-color: red; … Read more

[Solved] Fetching last 200 records from table [closed]

include the order by clause to get the last 200 records. SELECT c.member_id,c.message_id, fm.firstname AS fname, up.gender, TIMESTAMPDIFF( YEAR, up.dob, NOW( ) ) AS age, c.upload_img, c.image, c.message_id AS msg_id, c.message AS msg, c.posted_timestamp AS time, c.topic_id AS topic_id, u.croppedpicture_filename,u.picture_filename FROM conversation_messages_tbl c, user_profileinformation_tbl up, user_tbl u, family_member_tbl fm WHERE c.member_id = fm.family_member_id AND up.user_id … Read more

[Solved] Arithmetic expression before the equal sign

Your so called equal sign (=) is actually assignment operator in programming world. Equal sign is double equal == which may use in logical opeartion. ctr =+ 1; // means, assign positive 1 into ctr, Compile fine ctr =- 1; // means, assign negative 1 into ctr, Compile fine ctr =* 1; //Compilation error like … Read more

[Solved] Java reserved words as identifiers [closed]

I think you may have figured out by yourself that reserve words are also case sensitive when you say that Java is case sensitive. Using LONG as identifier would not cause any problem for the Java compiler, but the problem is variable name LONG may not mean much and might not contribute to a readable … Read more

[Solved] Find second highest number without using array [duplicate]

Bad check of value in your way. For example, like this #include <stdio.h> #define EOI -1 //End Of Input int main(void){ int input, first, second; first = second = EOI; while(1){ if(1 != scanf(“%d”, &input)){ fprintf(stderr, “invalid input!\n”); return -1; } if(input == EOI) break; if(first == EOI){ first = input; } else if(first <= … Read more